viirya commented on code in PR #733:
URL: https://github.com/apache/datafusion-comet/pull/733#discussion_r1768932963


##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -3277,4 +3295,41 @@ object QueryPlanSerde extends Logging with 
ShimQueryPlanSerde with CometExprShim
       true
     }
   }
+
+  private def validatePartitionAndSortSpecsForWindowFunc(
+      partitionSpec: Seq[Expression],
+      orderSpec: Seq[SortOrder],
+      op: SparkPlan): Boolean = {
+    if (partitionSpec.length != orderSpec.length) {
+      withInfo(op, "Partitioning and sorting specifications do not match")
+      return false
+    } else {
+      val partitionColumnNames = partitionSpec.collect { case a: 
AttributeReference =>
+        a.name
+      }
+
+      if (partitionColumnNames.length != partitionSpec.length) {
+        withInfo(op, "Unsupported partitioning specification")
+        return false
+      }
+
+      val orderColumnNames = orderSpec.collect { case s: SortOrder =>
+        s.child match {
+          case a: AttributeReference => a.name
+        }
+      }
+
+      if (orderColumnNames.length != orderSpec.length) {
+        withInfo(op, "Unsupported SortOrder")
+        return false
+      }
+
+      if (partitionColumnNames.toSet != orderColumnNames.toSet) {
+        withInfo(op, "Partitioning and sorting specifications do not match")
+        return false
+      }

Review Comment:
   Maybe check the partition column and order column one by one instead of a 
set? I'm not sure if `(PARTITION BY k, v ORDER BY v, k)` work.



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