Latest Results
feat: add Spark-compatible string functions (translate, substring_index, soundex, ascii, chr, space) (#7070)
## Description
Add 6 Spark-compatible string functions to improve Spark SQL
compatibility coverage (translate, substring_index, soundex, ascii, chr,
space)
## Changes Made
### New Functions Implemented
| Function | Description |
|----------|-------------|
| `translate(str, from, to)` | Replaces characters in `str` that exist
in `from` with corresponding characters in `to`. Characters without a
match are removed. |
| `substring_index(str, delim, count)` | Returns substring before
`count` occurrences of delimiter. Positive counts from left, negative
from right. |
| `soundex(str)` | Returns the 4-character Soundex phonetic code of the
string. |
| `ascii(str)` | Returns the ASCII numeric value of the first character.
Returns 0 for empty strings. |
| `chr(expr)` | Converts an integer ASCII code to its corresponding
character. |
| `space(n)` | Returns a string consisting of `n` space characters. |
### Files Added
- `src/daft-functions-utf8/src/translate.rs`
- `src/daft-functions-utf8/src/substring_index.rs`
- `src/daft-functions-utf8/src/soundex.rs`
- `src/daft-functions-utf8/src/ascii.rs`
- `src/daft-functions-utf8/src/chr.rs`
- `src/daft-functions-utf8/src/space.rs`
### Files Modified
- `src/daft-functions-utf8/src/lib.rs` - Register new modules and
functions
- `daft/functions/str.py` - Python API function definitions
- `daft/functions/__init__.py` - Export new functions
- `daft/expressions/expressions.py` - Expression class methods
### Implementation Details
Each function implements the full stack:
1. **Rust core logic** - `ScalarUDF` trait implementation with unit
tests
2. **SQL registration** - Auto-registered via `FunctionRegistry`
3. **Python API** - Both standalone function and `Expression` method
## Related Issues
Closes #7069
---------
Co-authored-by: Rohit Kulshreshtha <rohit.in.pune@gmail.com> Latest Branches
0%
BABTUNA:perf/packed-symbol-groupby 0%
BABTUNA:feat/temporal-tz-conversions +12%
jackylee-ch:codex-fix-parquet-map-schema-cast © 2026 CodSpeed Technology