Uh oh!
There was an error while loading. Please reload this page.
[SPARK-33393][SQL] Support SHOW TABLE EXTENDED in v2 - #37588
Conversation
panbingkun
commented
Aug 20, 2022
cc @MaxGekk |
AmplabJenkins
commented
Aug 21, 2022
Can one of the admins verify this patch? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Fokko
commented
Nov 28, 2022
@panbingkun@MaxGekk Any progress on this? Thanks! |
ja-michel
commented
Nov 30, 2022
+1 |
1 similar comment
rshanmugam1
commented
Dec 2, 2022
+1 |
MaxGekk
commented
Feb 1, 2023
@panbingkun Could you resolve conflicts when you have time, please. |
panbingkun
commented
Feb 5, 2023
Done |
xkrogen
commented
Feb 13, 2023
@MaxGekk are you able to take another look at this PR? Would love to see it go in, this is an annoying feature gap that we need to work around currently for DSv2 sources :( |
MaxGekk
commented
Feb 13, 2023
No, I haven't looked at this yet because of my wedding. :-)
@xkrogen If you really need this feature, please, review this PR. I will join to you slightly later. |
| pattern: Option[String]) extends V2CommandExec with LeafExecNode { | ||
| pattern: Option[String], | ||
| isExtended: Boolean = false, | ||
| partitionSpec: Option[TablePartitionSpec] = None) extends V2CommandExec with LeafExecNode { |
There was a problem hiding this comment.
TablePartitionSpec is legacy one, can't you use ResolvedPartitionSpec? For example, see
| // "Partition Values" | ||
| val partitionSchema = partitionTable.partitionSchema() | ||
| val normalizedSpec = normalizePartitionSpec( |
There was a problem hiding this comment.
This one is not needed. The job should be done by ResolvePartitionSpec.resolvePartitionSpec, or there is some reason to bypass it?
There was a problem hiding this comment.
Yes, the latest version has eliminated the above logic.
| requireExactMatchedPartitionSpec(identifier.toString, | ||
| normalizedSpec, partitionSchema.fieldNames) | ||
| val partitionNames = normalizedSpec.keySet |
| convertToPartIdent(normalizedSpec, partitionSchema)) | ||
| val partitionIdentifiers = partitionTable.listPartitionIdentifiers(names.toArray, ident) | ||
| partitionIdentifiers.length match { | ||
| case 0 => |
There was a problem hiding this comment.
The functions extendedPartition() is invoked only for non-empty partition spec as I can see, or not? Is there any test for this case?
| case 0 => | ||
| throw QueryExecutionErrors.notExistPartitionError( | ||
| identifier.toString, ident, partitionSchema) | ||
| case len if (len > 1) => |
There was a problem hiding this comment.
nit:
| case len if(len >1)=> | |
| case len if len >1=> |
| var i = 0 | ||
| while (i < len) { |
There was a problem hiding this comment.
This loop:
vari=0while (i < len) {
i +=1
}can be simplified by:
for (i <-0 until len) {
}Uh oh!
There was an error while loading. Please reload this page.
| catalog: String, | ||
| namespace: String, | ||
| table: String): (String, Map[String, String]) = { | ||
| ("_LEGACY_ERROR_TEMP_1251", |
There was a problem hiding this comment.
how hard it is to unify this error between v1 and v2 tables?
There was a problem hiding this comment.
_LEGACY_ERROR_TEMP_1231(QueryCompilationErrors#invalidPartitionColumnKeyInTableError), there are approximately
13code point to call it:
spark/common/utils/src/main/resources/error/error-classes.json
Lines 4815 to 4819 in 1359c13
_LEGACY_ERROR_TEMP_1251(QueryCompilationErrors#actionNotAllowedOnTableSincePartitionMetadataNotStoredError), there are approximately
8code point to call it:
spark/common/utils/src/main/resources/error/error-classes.json
Lines 4860 to 4864 in 1359c13
Because there are many scopes involved, in order to reduce the interference of logic on this PR, I suggest doing the merging or unification in a new separate PR.
Do you think this is appropriate?
There was a problem hiding this comment.
make senses, let's do it in followup
cloud-fan
left a comment
There was a problem hiding this comment.
I think it's pretty close now, thanks for your patience!
I will update it today. |
Co-authored-by: Wenchen Fan <cloud0fan@gmail.com>
| val globalTempViews = if (dbName == globalTempViewManager.database) { | ||
| globalTempViewManager.listViewNames(pattern).map { viewName => | ||
| globalTempViewManager.get(viewName).map(_.tableMeta).getOrElse( | ||
| throw new NoSuchTableException(globalTempViewManager.database, viewName)) |
There was a problem hiding this comment.
It's weird to throw this error during listing views. Shall we use flatMap and just skip the temp views that were deleted immediately after globalTempViewManager.listViewNames?
| val localTempViews = listLocalTempViews(pattern).map { viewIndent => | ||
| tempViews.get(viewIndent.table).map(_.tableMeta).getOrElse( | ||
| throw new NoSuchTableException(viewIndent.database.getOrElse(""), viewIndent.table)) |
| ctx: ShowTableExtendedContext): LogicalPlan = withOrigin(ctx) { | ||
| val partitionKeys = Option(ctx.partitionSpec).map { specCtx => | ||
| UnresolvedPartitionSpec(visitNonOptionalPartitionSpec(specCtx), None) | ||
| @inline def createUnresolvedTable( |
There was a problem hiding this comment.
not this kind of inline... we can remove this function and put the code in where we call the function
There was a problem hiding this comment.
Okay,I misunderstood the meaning, haha
| val dbName = format(db) | ||
| val globalTempViews = if (dbName == globalTempViewManager.database) { |
There was a problem hiding this comment.
| valdbName= format(db) | |
| valglobalTempViews=if (dbName == globalTempViewManager.database) { | |
| valglobalTempViews=if (format(db) == globalTempViewManager.database) { |
| if (table.supportsPartitions && table.asPartitionable.partitionSchema().nonEmpty) { | ||
| partitionColumns = table.asPartitionable.partitionSchema() | ||
| results.put("Partition Provider", "Catalog") | ||
| results.put("Partition Columns", table.asPartitionable.partitionSchema().map( |
There was a problem hiding this comment.
| results.put("Partition Columns", table.asPartitionable.partitionSchema().map( | |
| results.put("Partition Columns", partitionColumns.map( |
cloud-fan
commented
Nov 12, 2023
unfortunately this has conflicts now... |
panbingkun
commented
Nov 12, 2023
Done, I have resolved these conflicts. |
@cloud-fan If you have time, could you please take a look at this PR? Thank you very much! |
cloud-fan
commented
Nov 16, 2023
thanks, merging to master! |
Thank for all reviewing and great help again @cloud-fan@MaxGekk@beliefer@LuciferYang ❤️❤️❤️ |
What changes were proposed in this pull request?
The pr aim to implement v2 SHOW TABLE EXTENDED as
ShowTableExecWhy are the changes needed?
To have feature parity with the datasource V1.
Does this PR introduce any user-facing change?
Yes, Support SHOW TABLE EXTENDED in v2.
How was this patch tested?
Add new UT.
By running the unified tests for v2 implementation: