ganeshashree opened a new pull request, #58896: URL: https://github.com/apache/spark/pull/58896
### What changes were proposed in this pull request? Direct-star preprocessing (`ResolveReferences.expandStarExpression` in the fixed-point analyzer and `FunctionResolverUtils.handleStarInArguments` in the single-pass resolver) and the later `ResolveFunctions` each resolved the owner of a routed SQL/JSON call (`json_array`, `json_value`, `json_query`, `json_exists`) independently against the SQL PATH. This resolves the owner once and binds it: - Replace the Boolean `FunctionResolution.resolvesToStarDisallowedSqlJsonFunction` with `selectRoutedSqlJsonDirectStarOwner`, returning `RoutedSqlJsonStarOwner` (`RejectStockBuiltin` / `BindShadowOwner(candidate)` / `NoBinding`). - When a shadow owns the call, expand its star and record the winning fully-qualified candidate on the new `UnresolvedFunction.boundOwner`; `resolveFunction` then resolves only that candidate, failing with `UNRESOLVED_ROUTINE` if it disappeared, instead of falling back to the stock built-in. - Stock-builtin rejection, `count(*)` / `count(tbl.*)` handling, and `injectFunction`-replacement semantics are unchanged. The check is shared by both analyzer strategies. ### Why are the changes needed? If a visible temporary or persistent shadow is dropped between the two phases, preprocessing expands the direct star for the shadow while resolution then falls through to the stock built-in, which no longer sees a `Star` and so skips `INVALID_USAGE_OF_STAR_OR_REGEX`. ### Does this PR introduce _any_ user-facing change? No, beyond fixing the above analysis inconsistency, which is only reachable under concurrent DDL between a single query's analysis phases. ### How was this patch tested? New deterministic interleaving test in `JsonArraySuite`, run for both the fixed-point and single-pass analyzers, using a catalog that reports the shadow as existing during preprocessing but fails to load it at resolution. Existing routed-function shadowing, star-rejection, `count`, `persistentCatalogFirst`, temp-table-terminal, injected-function, and view-frozen-catalog tests continue to pass. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac This pull request and its description were written by Isaac. -- 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]
