huaxingao commented on a change in pull request #34914:
URL: https://github.com/apache/spark/pull/34914#discussion_r780854363



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala
##########
@@ -141,20 +135,47 @@ private[sql] object BucketTransform {
 
   def unapply(transform: Transform): Option[(Int, NamedReference, 
NamedReference)] =
       transform match {
-    case NamedTransform("bucket", Seq(
-        Lit(value: Int, IntegerType),
-        Ref(partCols: Seq[String]),
-        Ref(sortCols: Seq[String]))) =>
-      Some((value, FieldReference(partCols), FieldReference(sortCols)))
-    case NamedTransform("bucket", Seq(
-        Lit(value: Int, IntegerType),
-        Ref(partCols: Seq[String]))) =>
-      Some((value, FieldReference(partCols), 
FieldReference(Seq.empty[String])))
+    case NamedTransform("sorted_bucket", arguments) =>
+      var index: Int = -1
+      var posOfLit: Int = -1
+      var numOfBucket: Int = -1
+      arguments.foreach {
+        case Lit(value: Int, IntegerType) =>
+          numOfBucket = value
+          index = index + 1
+          posOfLit = index
+        case _ => index = index + 1
+      }
+      Some(numOfBucket, 
FieldReference(arguments.take(posOfLit).map(_.describe)),
+        FieldReference(arguments.drop(posOfLit + 1).map(_.describe)))
+    case NamedTransform("bucket", Seq(Lit(value: Int, IntegerType), Ref(seq: 
Seq[String]))) =>

Review comment:
       Seems somehow only a single column is supported in `BucketTransform`. 
Will fix this.




-- 
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