RainierLarry commented on code in PR #13746:
URL: https://github.com/apache/gluten/pull/13746#discussion_r4699914992


##########
gluten-substrait/src/main/scala/org/apache/gluten/config/GlutenConfig.scala:
##########
@@ -1056,6 +1056,15 @@ object GlutenConfig extends ConfigRegistry {
       .booleanConf
       .createWithDefault(true)
 
+  val COLUMNAR_STREAMING_AGGREGATE_REPORT_ORDERING =
+    buildConf("spark.gluten.sql.columnar.streamingAggregate.reportOrdering")
+      .doc(
+        "When true, a streaming aggregate reports its grouping keys 
(ascending) as its output " +
+          "ordering, like vanilla Spark's SortAggregateExec. A parent sort 
merge join or " +
+          "aggregate on the same keys can then skip a sort or run as a 
streaming aggregate.")
+      .booleanConf
+      .createWithDefault(true)

Review Comment:
   Thanks for the question! The main reason is the risk of silent wrong 
results. Once a streaming aggregate reports its grouping keys as its output 
ordering, Gluten stops adding the sort for a parent sort merge join, streaming 
window or aggregate on those keys. If that ordering is ever wrong (for example, 
a backend change that lets the streaming aggregate emit rows early or out of 
order, or an aggregate that reports an ordering it doesn't keep), the parent 
reads unsorted input: a sort merge join can miss matches, and a window or 
aggregate can compute over the wrong rows. Nothing fails, so it would be hard 
to notice.
   
   This conf gives users a quick way to go back to the previous plans without 
waiting for a new release. I've made it `.internal()` so it's no longer in the 
public config docs.
   
   Does that sound reasonable? If you'd still prefer not to have it, I'm happy 
to remove it.



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