You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "mihailom-db (via GitHub)" <gi...@apache.org> on 2024/08/02 09:22:28 UTC

[PR] [SPARK-49063][SQL]Fix Between with ScalarSubqueries [spark]

mihailom-db opened a new pull request, #47581:
URL: https://github.com/apache/spark/pull/47581

   ### What changes were proposed in this pull request?
   Fix for between with ScalarSubqueries.
   
   
   ### Why are the changes needed?
   There is a regression from some previous PR.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Between is fixed.
   
   
   ### How was this patch tested?
   Tests added to golden file.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #47581:
URL: https://github.com/apache/spark/pull/47581#issuecomment-2268449298

   thanks, merging to master!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #47581:
URL: https://github.com/apache/spark/pull/47581#issuecomment-2267979890

   > Fix for between with ScalarSubqueries.
   
   What does this PR fix?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #47581:
URL: https://github.com/apache/spark/pull/47581#issuecomment-2268432411

   thanks, merging to master!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #47581: [SPARK-49063][SQL] Fix Between with ScalarSubqueries
URL: https://github.com/apache/spark/pull/47581


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #47581:
URL: https://github.com/apache/spark/pull/47581#discussion_r1701960014


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -4603,6 +4603,15 @@ object SQLConf {
       .booleanConf
       .createWithDefault(true)
 
+  val OPTIMIZE_BETWEEN =
+    buildConf("spark.sql.optimizeBetween")

Review Comment:
   It's not only an optimization, but also a correctness fix if the BETWEEN input is nondeterministic. I think a legacy config is better here. How about `spark.sql.legacy.duplicateBetweenInput`? By default it's false, and people can set it to true to restore to the legacy behavior.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-49063][SQL] Fix Between with ScalarSubqueries [spark]

Posted by "mihailom-db (via GitHub)" <gi...@apache.org>.
mihailom-db commented on PR #47581:
URL: https://github.com/apache/spark/pull/47581#issuecomment-2268238579

   @HyukjinKwon This ticket's PR https://issues.apache.org/jira/browse/SPARK-46366 introduced an optimization for Between expression. Unfortunately it lead to ScalarSubqueries being firstly resolved before duplicated. This lead to failure in RewriteCorrelatedScalarSubqueries as resolved Subqueries will not need another alias resolution, so we would end up left joining the same query twice. Left join is unresolved if both sides have the same alias.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org