andygrove commented on code in PR #6927:
URL: https://github.com/apache/datafusion-comet/pull/6927#discussion_r4261306703


##########
spark/src/main/scala/org/apache/comet/serde/aggregates.scala:
##########
@@ -1475,14 +1475,16 @@ object AggSerde {
 
   /**
    * Shared support level for `Min` / `Max` based on the result data type. 
Floats follow Spark's
-   * ordering natively, so strict floating-point mode does not apply to them.
+   * ordering natively, so strict floating-point mode does not apply to them. 
Spark and the native
+   * accumulators both compare strings and binary as unsigned bytes, except 
that Spark orders a
+   * string with a non-default collation by that collation.
    */
-  def minMaxSupportLevel(dt: DataType): SupportLevel = {
-    if (!minMaxDataTypeSupported(dt)) {
-      Unsupported(Some(s"Unsupported data type: $dt"))
-    } else {
-      Compatible()
-    }
+  def minMaxSupportLevel(dt: DataType): SupportLevel = dt match {
+    case _: StringType if isStringCollationType(dt) =>
+      Unsupported(Some(ComparisonUtils.nonDefaultCollationReason("min/max")))
+    case _: StringType | BinaryType => Compatible()

Review Comment:
   I agree the accounting is off. `set_value` keeps the old allocation and 
`size()` only counts lengths, and DataFusion main has the same code. As far as 
I can tell it only matters for the hash shape, where string `min`/`max` sits 
next to something like `collect_set`. Spark plans plain string `min`/`max` as a 
sort aggregate, and Comet runs that as DataFusion's ordered streams, which emit 
each group as soon as it is complete. I don't think it needs to hold this PR. 
The fix belongs upstream, so I filed #6936 to track it, and we can pick it up 
in the next DataFusion upgrade or a branch-55 backport.



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