feat(extensions): add subscript_operator and index_of functions#1020
Closed
benbellick wants to merge 6 commits into
Closed
feat(extensions): add subscript_operator and index_of functions#1020benbellick wants to merge 6 commits into
benbellick wants to merge 6 commits into
Conversation
benbellick
force-pushed
the
benbellick/element-at
branch
from
March 23, 2026 21:48
45af49b to
32319f4
Compare
benbellick
commented
Mar 23, 2026
benbellick
commented
Mar 23, 2026
…L standard semantics
benbellick
marked this pull request as ready for review
March 24, 2026 16:27
benbellick
requested review from
EpsilonPrime,
cpcloud,
jacques-n,
vbarua,
westonpace and
yongchul
as code owners
March 24, 2026 16:27
yongchul
reviewed
Mar 25, 2026
Comment on lines
+137
to
+139
| to the common array subscript operator []. | ||
|
|
||
| Index is 1-based (i.e., the first element is at index 1). Out-of-bounds |
Contributor
There was a problem hiding this comment.
I believe #917 is proposing 0-based index 😆 I believe I commented whether we should offer an option to do either zero-based index or one-based index... So, we'd better be consistent.
|
This PR has been automatically marked as stale because it has not had |
|
This PR has been automatically closed due to inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding two common list functions to the core spec.
subscript_operatorReturns the element at a 1-based index, or NULL for out-of-bounds access. Matches PostgreSQL and CockroachDB semantics.
In an earlier iteration, I tried to get this to cover more databases (e.g. Trino) but it was becoming an hodgepodge of configuration parameters, so I opted to just have the simple impl for now. We can add more complexity later if necessary.
index_ofReturns the 1-based index of the first occurrence of a value in a list, or NULL if not found. Matches PostgreSQL, DuckDB, DataFusion, and CockroachDB.
Trino returns 0 instead of NULL when not found, which is... strange. Just going to not have Trino's behavior represented here.
Verification script
Closes #967
This change is