marko-radoicic-db opened a new pull request, #60754: URL: https://github.com/apache/spark/pull/60754
### What changes were proposed in this pull request? Moves the logic that replaces SQL function input aliases with their input expressions in join conditions into helpers in `object Analyzer`: `inlineSQLFunctionInputs`, `buildSQLFunctionInputAliasMap` and `replaceSQLFunctionInputAttributes`. The join case of `ResolveSQLFunctions` now calls `inlineSQLFunctionInputs`. The attribute replacement uses `transformUp` instead of `transform`. The pattern only matches leaf `Attribute` nodes, and the replacement expressions are never traversed again, so both traversals produce the same result. The replacement inputs come from the `OneRowRelation` project built in `rewriteSQLFunctions`, so they cannot reference the alias attributes that the map is keyed on. ### Why are the changes needed? This is a refactor with no functional change. Other resolution paths, such as join resolution in the single-pass resolver, can apply the same substitution through these helpers and produce identical plans. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? No new tests. The change is covered by the existing SQL UDF join-condition cases in `sql/core/src/test/resources/sql-tests/inputs/sql-udf.sql` (around lines 639-651, for example `SELECT * FROM t1 JOIN t2 ON foo3_1a(t1.c1, t2.c2) >= 2;`), which go through this rewrite path. I did not run these suites or compile catalyst for this PR, so the result is unverified. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac (Claude Haiku 5.5) 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]
