Repository navigation
fix: handle empty delimiter in split_part (closes #20503) - #20542
Merged
alamb merged 2 commits intoFeb 26, 2026
Merged
Conversation
LiaCastaneda
approved these changes
Feb 25, 2026
LiaCastaneda
left a comment
Contributor
There was a problem hiding this comment.
This lgtm 👍 thanks!
| Utf8, | ||
| StringArray | ||
| ); | ||
| // Edge cases with delimiters |
Contributor
There was a problem hiding this comment.
wdyt about adding a couple of test cases for these edge cases in the sqllogic tests too?
gabotechs
approved these changes
Feb 25, 2026
Contributor
|
Thank you @gferrate and @gabotechs |
LiaCastaneda
pushed a commit
to DataDog/datafusion
that referenced
this pull request
Mar 3, 2026
…he#20542) - Closes apache#20503 `split_part` did not handle empty delimiters in a PostgreSQL-compatible way (`split("")` in Rust creates leading/trailing empty fields). This could return unexpected results for positions like `1` / `-1` and out-of-range values. This PR aligns behavior with Postgres semantics for empty delimiters. Small change in how we treat the 1, -1 Indeed! Yes, behavior is now more consistent with PostgreSQL for `split_part(str, '', n)`. No API changes. (cherry picked from commit 3ab1301)
LiaCastaneda
pushed a commit
to DataDog/datafusion
that referenced
this pull request
Mar 3, 2026
…he#20542) - Closes apache#20503 `split_part` did not handle empty delimiters in a PostgreSQL-compatible way (`split("")` in Rust creates leading/trailing empty fields). This could return unexpected results for positions like `1` / `-1` and out-of-range values. This PR aligns behavior with Postgres semantics for empty delimiters. Small change in how we treat the 1, -1 Indeed! Yes, behavior is now more consistent with PostgreSQL for `split_part(str, '', n)`. No API changes. (cherry picked from commit 3ab1301)
LiaCastaneda
added a commit
to DataDog/datafusion
that referenced
this pull request
Mar 3, 2026
…he#20542) (#88) - Closes apache#20503 `split_part` did not handle empty delimiters in a PostgreSQL-compatible way (`split("")` in Rust creates leading/trailing empty fields). This could return unexpected results for positions like `1` / `-1` and out-of-range values. This PR aligns behavior with Postgres semantics for empty delimiters. Small change in how we treat the 1, -1 Indeed! Yes, behavior is now more consistent with PostgreSQL for `split_part(str, '', n)`. No API changes. (cherry picked from commit 3ab1301) Co-authored-by: Gabriel Ferraté <gabriel.ferrate@datadoghq.com>
de-bgunter
pushed a commit
to de-bgunter/datafusion
that referenced
this pull request
Mar 24, 2026
…he#20542) ## Which issue does this PR close? - Closes apache#20503 ## Rationale for this change `split_part` did not handle empty delimiters in a PostgreSQL-compatible way (`split("")` in Rust creates leading/trailing empty fields). This could return unexpected results for positions like `1` / `-1` and out-of-range values. This PR aligns behavior with Postgres semantics for empty delimiters. ## What changes are included in this PR? Small change in how we treat the 1, -1 ## Are these changes tested? Indeed! ## Are there any user-facing changes? Yes, behavior is now more consistent with PostgreSQL for `split_part(str, '', n)`. No API changes.
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.
Which issue does this PR close?
Rationale for this change
split_partdid not handle empty delimiters in a PostgreSQL-compatible way (split("")in Rust creates leading/trailing empty fields).This could return unexpected results for positions like
1/-1and out-of-range values.This PR aligns behavior with Postgres semantics for empty delimiters.
What changes are included in this PR?
Small change in how we treat the 1, -1
Are these changes tested?
Indeed!
Are there any user-facing changes?
Yes, behavior is now more consistent with PostgreSQL for
split_part(str, '', n).No API changes.