agubichev commented on code in PR #41439:
URL: https://github.com/apache/spark/pull/41439#discussion_r1258989422
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala:
##########
@@ -598,26 +600,43 @@ object RewriteCorrelatedScalarSubquery extends
Rule[LogicalPlan] with AliasHelpe
val joinHint = JoinHint(None, subHint)
val resultWithZeroTups = evalSubqueryOnZeroTups(query)
- lazy val planWithoutCountBug = Project(
- currentChild.output :+ origOutput,
- Join(currentChild, query, LeftOuter, conditions.reduceOption(And),
joinHint))
+
+ // Reassign expression IDs in the future right side of the join to
avoid ID conflicts.
+ val newQuery = if
(SQLConf.get.getConf(REASSIGN_IDS_IN_SCALAR_SUBQUERY)) {
+ AssignNewExprIds(query)
+ } else {
+ query
+ }
+ val newOutput = newQuery.output.head.withNullability(true)
Review Comment:
done
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -4280,6 +4280,13 @@ object SQLConf {
.checkValue(_ >= 0, "The threshold of cached local relations must not be
negative")
.createWithDefault(64 * 1024 * 1024)
+ val REASSIGN_IDS_IN_SCALAR_SUBQUERY =
+ buildConf("spark.sql.optimizer.reassignIdsInScalarSubquery.enabled")
+ .internal()
+ .doc("Reassigns expression IDs in scalar subqueries.")
Review Comment:
done
--
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]