Skip to content

fix(optimizer): robust scope for UDTF#7535

Merged
geooo109 merged 2 commits intomainfrom
geooo109/udtf_scope
Apr 21, 2026
Merged

fix(optimizer): robust scope for UDTF#7535
geooo109 merged 2 commits intomainfrom
geooo109/udtf_scope

Conversation

@geooo109
Copy link
Copy Markdown
Collaborator

@geooo109 geooo109 commented Apr 21, 2026

For the cases where we have a UDTF and we have to avoid collecting it if it's not a source.

There are cases such as the following

SELECT ... FROM ... WHERE x IN UNNEST(...)

where udtf doesn't work as a source.

Comment thread sqlglot/optimizer/scope.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:geooo109/udtf_scope, sqlglot version: geooo109/udtf_scope)
  • baseline (main, sqlglot version: 0.0.1.dev1)

By Dialect

dialect main sqlglot:geooo109/udtf_scope transitions links
bigquery -> bigquery 24643/24648 passed (100.0%) 23495/23495 passed (100.0%) No change full result / delta
bigquery -> duckdb 867/1154 passed (75.1%) 0/0 passed (0.0%) Results not found full result / delta
duckdb -> duckdb 5823/5823 passed (100.0%) 0/0 passed (0.0%) Results not found full result / delta
snowflake -> duckdb 1063/1961 passed (54.2%) 0/0 passed (0.0%) Results not found full result / delta
snowflake -> snowflake 65133/65133 passed (100.0%) 63027/63027 passed (100.0%) No change full result / delta
databricks -> databricks 1370/1370 passed (100.0%) 1370/1370 passed (100.0%) No change full result / delta
postgres -> postgres 6042/6042 passed (100.0%) 6042/6042 passed (100.0%) No change full result / delta
redshift -> redshift 7101/7101 passed (100.0%) 7101/7101 passed (100.0%) No change full result / delta

Overall

main: 113232 total, 112042 passed (pass rate: 98.9%), sqlglot version: 0.0.1.dev1

sqlglot:geooo109/udtf_scope: 101035 total, 101035 passed (pass rate: 100.0%), sqlglot version: geooo109/udtf_scope

Transitions:
No change

Dialect pair changes: 0 previous results not found, 3 current results not found

✅ 32 test(s) passed

@geooo109 geooo109 merged commit 6053db6 into main Apr 21, 2026
9 of 10 checks passed
@geooo109 geooo109 deleted the geooo109/udtf_scope branch April 21, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants