2010YOUY01 commented on code in PR #12383:
URL: https://github.com/apache/datafusion/pull/12383#discussion_r1749178924
##########
datafusion/functions/src/unicode/substr.rs:
##########
@@ -180,32 +197,26 @@ fn string_view_substr(
let start_array = as_int64_array(&args[0])?;
+ // In either case of `substr(s, i)` or `substr(s, i, cnt)`
+ // If any of input argument is `NULL`, the result is `NULL`
match args.len() {
1 => {
- for (idx, (raw, start)) in string_view_array
- .views()
+ for ((str_opt, raw_view), start_opt) in string_view_array
Review Comment:
The old implementation will treat empty string in view as `NULL` (within
`make_and_append_view()`), so it handled `NULL` case correctly but handled the
empty string case wrong.
Since it's not possible to use view to check if the current element is null,
so here we also have to iterate on the string array to check whether each
element is `NULL`
--
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]