Akanksha-kedia opened a new pull request, #19049: URL: https://github.com/apache/pinot/pull/19049
## Description The 4-argument `splitPart` overload in `StringFunctions` previously allocated a full `String[]` via `StringUtils.splitByWholeSeparator` on every call, even when only a single element was needed. This is wasteful in hot query paths where `splitPart` is invoked per-row. ### Fix Replace the array-based implementation with index-based forward scanning that extracts only the requested element without materializing all split parts: - Iterate through the string once, counting delimiter occurrences - Stop and extract the substring as soon as the target index is reached - No intermediate array allocation **Positive index:** scan left-to-right, stop at the `limit`-th delimiter. **Negative index:** scan right-to-left using `lastIndexOf`, count backward. The behavior and return values are unchanged — this is a pure performance optimization. ## Test plan - [ ] Existing `StringFunctionsTest` / `splitPart` test cases all pass - [ ] No behavior change — same outputs for all valid and edge-case inputs -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
