itholic commented on code in PR #39702:
URL: https://github.com/apache/spark/pull/39702#discussion_r1086259893


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala:
##########
@@ -1050,15 +1052,17 @@ class AnalysisErrorSuite extends AnalysisTest {
     val t2 = LocalRelation(b, c).as("t2")
 
     // SELECT * FROM t1 WHERE a = (SELECT sum(c) FROM t2 WHERE t1.* = t2.b)
-    assertAnalysisError(
+    assertAnalysisErrorClass(
       Filter(EqualTo(a, ScalarSubquery(t2.select(sum(c)).where(star("t1") === 
b))), t1),
-      "Invalid usage of '*' in Filter" :: Nil
+      expectedErrorClass = "INVALID_USAGE_OF_STAR",
+      expectedMessageParameters = Map("elem" -> "'*'", "prettyName" -> 
"Filter")
     )
 
     // SELECT * FROM t1 JOIN t2 ON (EXISTS (SELECT 1 FROM t2 WHERE t1.* = b))
-    assertAnalysisError(
+    assertAnalysisErrorClass(
       t1.join(t2, condition = Some(Exists(t2.select(1).where(star("t1") === 
b)))),
-      "Invalid usage of '*' in Filter" :: Nil
+      expectedErrorClass = "INVALID_USAGE_OF_STAR",
+      expectedMessageParameters = Map("elem" -> "'*'", "prettyName" -> 
"Filter")

Review Comment:
   Thanks @MaxGekk for review.
   
   I tried to output a SQL statement here, but unfortunately I couldn't proper 
way to expose the SQL statement rather than node name 😢 
   
   The code path is here:
   
   
https://github.com/apache/spark/blob/866343c7be47d71b88ae9a6b4dda26f8c4f5964b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L247-L250
   
   The type of `operator` is `LogicalPlan`, and `s` is `Star` here.
   
   Can we extract the SQL statement from these objects?
   
   Do you happen to help outputting a SQL statement here??



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