cloud-fan commented on code in PR #59828:
URL: https://github.com/apache/spark/pull/59828#discussion_r4483416436


##########
sql/core/src/test/scala/org/apache/spark/sql/analysis/resolver/ResolverGuardSuite.scala:
##########
@@ -143,17 +143,21 @@ class ResolverGuardSuite extends ResolverGuardSuiteBase {
   test("SQL JSON constructor and path functions") {
     checkResolverGuard("""SELECT JSON_ARRAY(1, 'x', true)""")
     checkResolverGuard("""SELECT JSON_ARRAY('[1]' FORMAT JSON)""")
+    // Nested clause-free JSON_ARRAY routes as UnresolvedRoutedJsonArray 
before resolution; the
+    // guard gives it the flat call's owner check and admits the unshadowed 
built-in.
+    checkResolverGuard("""SELECT JSON_ARRAY(JSON_ARRAY(1))""")
     checkResolverGuard("""SELECT JSON_VALUE('{"a":1}', '$.a')""")
     checkResolverGuard("""SELECT JSON_VALUE('{"a":1}', '$.a' RETURNING INT)""")
     checkResolverGuard("""SELECT JSON_QUERY('{"a":[1]}', '$.a')""")
     checkResolverGuard("""SELECT JSON_QUERY('{"a":[1]}', '$.a' WITH ARRAY 
WRAPPER)""")
     checkResolverGuard("""SELECT JSON_EXISTS('{"a":1}', '$.a')""")
     checkResolverGuard("""SELECT JSON_EXISTS('{"a":1}', '$.a' TRUE ON 
ERROR)""")
-    // A clause-free JSON_OBJECT routes as an UnresolvedFunction unless a 
VALUE/colon member is raw;
-    // such a call, or a clause-bearing one, is built directly as a 
JsonObjectExpr. Assert the guard
-    // admits that direct form (removing its allowlist arm would fail here).
+    // Clause-bearing and explicit FORMAT JSON forms parse to a stock-owned 
UnresolvedJsonObject;

Review Comment:
   Thanks, you're right. Both are `TimeZoneAwareExpression`s, so the earlier 
`TimeZoneAwareExpression` arm admits them before the JSON arm is reached, as on 
master. The added case covers what can be checked here, so nothing more is 
needed.
   
   <!-- SPARK_DEV_REVIEW_REPLY 
{"feedback_id":"inline:4434559159","thread_id":"inline:4434559159","verdict_sha256":"7e5e8ac95419c2e46c30559d8d64a7dc25f5935dc865da58cbaca89b712baaa0"}
 -->



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