ganeshashree commented on code in PR #58450:
URL: https://github.com/apache/spark/pull/58450#discussion_r3947016700


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/resolver/FunctionResolverUtils.scala:
##########
@@ -57,18 +56,32 @@ trait FunctionResolverUtils {
    */
   protected def handleStarInArguments(
       unresolvedFunction: UnresolvedFunction): UnresolvedFunction = {
-    val functionContainsStarInArguments = unresolvedFunction.arguments.exists {
+    val functionContainsDirectStarInArguments = 
unresolvedFunction.arguments.exists {
       case _: Star => true
       case _ => false
     }
 
-    if (!functionContainsStarInArguments) {
+    // Whether the call resolves to the builtin `count` (distinct-agnostic). 
This owner probe can
+    // hit an external FunctionCatalog.functionExists lookup on a 
persistent-first SQL PATH, so
+    // compute it once and reuse it for both the count(*) normalization and 
the count(tbl.*) guard.
+    // Lazy so the non-star and JSON-constructor paths never pay for it.
+    lazy val resolvesToCountBuiltin =
+      
functionResolution.functionNameResolvesToBuiltin(unresolvedFunction.nameParts, 
"count")
+
+    if (functionContainsDirectStarInArguments &&
+        
functionResolution.resolvesToStarDisallowedJsonConstructor(unresolvedFunction.nameParts))
 {
+      // Only a bare `*` argument is rejected in a JSON constructor; a star 
nested in another

Review Comment:
   Done, reworded to "routed SQL/JSON functions".



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