srielau commented on code in PR #55717:
URL: https://github.com/apache/spark/pull/55717#discussion_r3208975986


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1981,14 +1981,15 @@ class Analyzer(
      * This is used for special syntax transformations (e.g., COUNT(*) -> 
COUNT(1)) that
      * should only apply to builtin functions, not to user-defined functions.
      *
-     * In legacy mode (sessionOrder="first"), temp functions shadow builtins, 
so an
-     * unqualified name that matches a temp function should NOT be treated as 
builtin.
+     * When the effective SQL PATH puts `system.session` before 
`system.builtin`, temp
+     * functions shadow builtins, so an unqualified name that matches a temp 
function
+     * should NOT be treated as builtin.
      */
     private def matchesFunctionName(nameParts: Seq[String], expectedName: 
String): Boolean = {
       if (!FunctionResolution.isUnqualifiedOrBuiltinFunctionName(nameParts, 
expectedName)) {
         return false
       }
-      if (nameParts.size == 1 && conf.sessionFunctionResolutionOrder == 
"first") {
+      if (nameParts.size == 1 && 
functionResolution.isSessionBeforeBuiltinInPath) {

Review Comment:
   Implemented in ad6dbd6cc2d. The single-pass path now uses the same gate as 
fixed-point for `count(*)` normalization: when PATH puts `system.session` 
before `system.builtin` and a temp `count` exists, single-pass skips `count(*) 
-> count(1)` rewrite. Concretely this is wired in `FunctionResolverUtils` (used 
by both `FunctionResolver` and `HigherOrderFunctionResolver`), and I added a 
`SetPathSuite` regression (`single-pass: count(*) rewrite respects PATH 
temp-before-builtin gate`).



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