You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/09/30 00:16:35 UTC

[GitHub] [spark] gengliangwang commented on a diff in pull request #38052: [SPARK-40618][SQL] Fix bug in MergeScalarSubqueries rule with nested subqueries

gengliangwang commented on code in PR #38052:
URL: https://github.com/apache/spark/pull/38052#discussion_r984111489


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/MergeScalarSubqueriesSuite.scala:
##########
@@ -560,19 +550,20 @@ class MergeScalarSubqueriesSuite extends PlanTest {
           Literal("a_plus2"), 'a_plus2,
           Literal("b"), 'b
         )).as("mergedValue"))
-    val analyzedMergedSubquery = mergedSubquery.analyze
-    val correctAnswer = WithCTE(
-      testRelation
-        .select(
-          extractorExpression(0, analyzedMergedSubquery.output, 0),
-          extractorExpression(0, analyzedMergedSubquery.output, 1),
-          extractorExpression(0, analyzedMergedSubquery.output, 2))
-        .where(
-          extractorExpression(0, analyzedMergedSubquery.output, 0) +
-          extractorExpression(0, analyzedMergedSubquery.output, 1) +
-          extractorExpression(0, analyzedMergedSubquery.output, 2) === 0),
-      Seq(definitionNode(analyzedMergedSubquery, 0)))
-
-    comparePlans(Optimize.execute(originalQuery.analyze), correctAnswer.analyze)
+    val correctAnswer =

Review Comment:
   Nit: It is better to have the `correctAnswer` as a logical plan instead of a string representation. Otherwise, later on if the `toString` representation is changed, we will need to change the test case here as well.



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