cloud-fan commented on code in PR #55718:
URL: https://github.com/apache/spark/pull/55718#discussion_r3199120958


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala:
##########
@@ -98,7 +99,10 @@ case class ShowCreateTableExec(
       val transforms = new ArrayBuffer[String]
       var bucketSpec = Option.empty[BucketSpec]
       table.partitioning.map {
-        case BucketTransform(numBuckets, col, sortCol) =>
+        case BucketTransform(numBuckets, col, sortCol) if 
table.isInstanceOf[V1Table] =>
+          if (bucketSpec.nonEmpty) {
+            throw 
QueryExecutionErrors.unsupportedMultipleBucketTransformsError()
+          }

Review Comment:
   The defensive `bucketSpec.nonEmpty` throw can't fire on the V1Table arm: 
`V1Table.partitioning` constructs partitioning from `v1Table.bucketSpec.foreach 
{ spec => partitions += spec.asTransform }`, so a V1Table is guaranteed to 
surface at most one `BucketTransform`. The pattern is borrowed from 
`CatalogV2Implicits.convertTransforms` where the input is user-supplied 
transforms and the guard is a real check, but here it's unreachable. Either 
drop it, or convert to an `assert` so future readers don't infer the V1Table 
path can produce multiple bucket transforms.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to