weimingdiit opened a new issue, #2132:
URL: https://github.com/apache/auron/issues/2132
**Describe**
Auron currently does not provide native support for the Spark SQL
`instr(str, substr)` function.
This causes compatibility gaps for queries migrated from Spark, especially
when users rely on Spark’s string search semantics where the function returns
the 1-based index of the first occurrence of `substr` in `str`.
Without native support, such queries may fall back to non-native execution
paths or fail to achieve expected Spark-compatible behavior.
**Solution**
Add native support for `instr(str, substr)` with Spark-compatible semantics.
Expected behavior:
- Returns the 1-based index of the first occurrence of `substr` in `str`
- Returns `0` if `substr` is not found
- Returns `1` when `substr` is an empty string
- Returns `NULL` if either argument is `NULL`
Examples:
- `instr('hello', 'll')` -> `3`
- `instr('hello', 'x')` -> `0`
- `instr('hello', '')` -> `1`
The implementation should be consistent with Spark SQL behavior and work for
scalar and column inputs.
**Additional context**
Spark defines `instr(str, substr)` as returning the 1-based position of the
first occurrence of `substr` in `str`.
This feature would improve Spark SQL compatibility and reduce fallback for
common string-processing workloads.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]