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