Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spark): Offset TRY_ELEMENT_AT index by one #4183

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

VaggelisD
Copy link
Collaborator

Public Slack context

In Spark TRY_ELEMENT_AT is 1-based while the bracket notation is 0-based:

spark-sql (default)> SELECT ARRAY(1, 2, 3)[0], TRY_ELEMENT_AT(ARRAY(1, 2, 3), 1);
1       1

This PR fixes this discrepancy by manually adding a 1-offset during parse & generation time.

@georgesittas georgesittas merged commit d38e023 into main Oct 1, 2024
6 checks passed
@georgesittas georgesittas deleted the vaggelisd/spark_element_at branch October 1, 2024 12:40
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