Latest Results
feat(utf8): add split_part string function (#7371)
## Changes Made
Daft has a split function that returns a list of parts, but no direct
way to split a string on a delimiter and select the nth part. This PR
adds split_part, which does exactly that with the same name and behavior
as the function in PostgreSQL, DuckDB, Snowflake and Spark:
split_part(input, delim, part) returns the requested part, 1-based.
Negative parts count from the end, out of range parts return an empty
string, part 0 raises an error, and an empty delimiter means the string
is not split.
The implementation follows the same structure as substring_index and
translate from #7070:
- `src/daft-functions-utf8/src/split_part.rs`: Rust kernel with unit
tests
- `src/daft-functions-utf8/src/lib.rs`: registration, which also enables
the SQL function
- `daft/functions/str.py`: Python API function with doctests
- `daft/functions/__init__.py`: export
- `daft/expressions/expressions.py`: Expression method
- `tests/expressions/test_utf8.py`: tests covering the DataFrame, SQL,
RecordBatch and Series paths
Naming: #7350 has an open discussion on whether a different name or an
argument on split would be clearer. I kept split_part since it is the
common name across engines, and I am happy to rename or adjust.
Test evidence:
```
cargo test -p daft-functions-utf8 split_part
test result: ok. 11 passed; 0 failed; 0 ignored
DAFT_RUNNER=native pytest tests/expressions/test_utf8.py
21 passed
pytest --doctest-modules daft/functions/str.py::daft.functions.str.split_part
1 passed
```
All pre-commit hooks pass, including mypy, ruff, rustfmt and clippy.
AI usage: I used Claude while working on this, mostly to help me follow
the existing patterns and keep the code consistent with the other string
functions. I read and tested everything myself before opening this PR.
## Related Issues
Fixes #7350 Latest Branches
+1%
0%
everettVT/fix-main-failures 0%
© 2026 CodSpeed Technology