Skip to content

Conversation

mihailotim-db
Copy link
Contributor

@mihailotim-db mihailotim-db commented Sep 26, 2025

What changes were proposed in this pull request?

Prefer table column over LCA when resolving array index.

Why are the changes needed?

For a query like:

SELECT 1 AS col1, col2[col1] FROM VALUES(0, ARRAY(1,2));

the output should be (1,1), but current Spark implementation outputs (1,2). This is because [col1] is resolved as an LCA instead of being resolved to a column. This is because we never actually resolve field of UnresolvedExtractValue in innerResolve, so the resolution of field fails over to the next item in precedence chain, which is LCA.

Does this PR introduce any user-facing change?

Yes, user now sees the correct result for the impacted query shape

How was this patch tested?

Added test case for the impacted query.

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Sep 26, 2025
@cloud-fan cloud-fan closed this in 46ac78e Sep 30, 2025
@cloud-fan
Copy link
Contributor

thanks, merging to master!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants