cloud-fan commented on a change in pull request #35221:
URL: https://github.com/apache/spark/pull/35221#discussion_r788305390
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Implicits.scala
##########
@@ -49,21 +51,27 @@ private[sql] object CatalogV2Implicits {
}
implicit class TransformHelper(transforms: Seq[Transform]) {
- def asPartitionColumns: Seq[String] = {
- val (idTransforms, nonIdTransforms) =
transforms.partition(_.isInstanceOf[IdentityTransform])
-
- if (nonIdTransforms.nonEmpty) {
- throw
QueryCompilationErrors.cannotConvertTransformsToPartitionColumnsError(nonIdTransforms)
+ def convertTransforms: (Seq[String], Option[BucketSpec]) = {
+ val identityCols = new mutable.ArrayBuffer[String]
+ var bucketSpec = Option.empty[BucketSpec]
+
+ transforms.map {
+ case IdentityTransform(FieldReference(Seq(col))) =>
+ identityCols += col
+
+ case BucketTransform(numBuckets, col, sortCol) =>
Review comment:
we should fail if there are more than one bucket transform. I think
people can trigger it like `PARTITIONED BY (bucket(4, col)) CLUSTERED BY col
INTO 4 BUCKETS`?
--
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]