aleksandar-trajkovic-db commented on code in PR #60235:
URL: https://github.com/apache/spark/pull/60235#discussion_r4511732107


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -7452,6 +7422,17 @@ object SQLConf {
       .booleanConf
       .createWithDefault(false)
 
+  val LEGACY_MYSQL_TOP_N_OVER_GROUP_BY_EXPR_ENABLED =
+    buildConf("spark.sql.legacy.mysql.topNOverGroupByExpr.enabled")
+      .internal()
+      .doc("When true, push ORDER BY ... LIMIT to MySQL on top of a pushed 
GROUP BY even when " +
+        "a sort key is built over a GROUP BY expression, such as GROUP BY a + 
1 ORDER BY " +
+        "(a + 1) * 2. MySQL rejects such queries under the default 
ONLY_FULL_GROUP_BY mode.")
+      .version("4.4.0")
+      .withBindingPolicy(ConfigBindingPolicy.NOT_APPLICABLE)
+      .booleanConf
+      .createWithDefault(false)

Review Comment:
   ONLY_FULL_GROUP_BY is enabled by default in MySQL 8+, which causes this 
syntax to be invalid, but the user can still disable it and make these valid 
queries, so we leave the option for the user to keep pushdown behavior in that 
case.



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