imay commented on a change in pull request #923: Fix concat_ws return null when
argument is null
URL: https://github.com/apache/incubator-doris/pull/923#discussion_r275265572
##########
File path: be/src/exprs/string_functions.cpp
##########
@@ -535,17 +526,47 @@ StringVal StringFunctions::concat_ws(
uint8_t* ptr = result.ptr;
// Loop again to append the data.
- memcpy(ptr, strs[0].ptr, strs[0].len);
- ptr += strs[0].len;
- for (int32_t i = 1; i < num_children; ++i) {
- memcpy(ptr, sep.ptr, sep.len);
- ptr += sep.len;
+ for (int32_t i = 0; i < num_children; ++i) {
memcpy(ptr, strs[i].ptr, strs[i].len);
ptr += strs[i].len;
}
return result;
}
+StringVal StringFunctions::concat_ws(
+ FunctionContext* context, const StringVal& sep,
+ int num_children, const StringVal* strs) {
+ DCHECK_GE(num_children, 1);
+ if (sep.is_null) {
+ return StringVal::null();
+ }
+
Review comment:
int total_size = 0;
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]