Skip to content

Commit

Permalink
ARROW-10050: [C++][Gandiva] Implement concat() in Gandiva for up to 1…
Browse files Browse the repository at this point in the history
…0 arguments

concat() is already implemented for 2 arguments in Gandiva. This PR attempts to implement concat() for up to 10 utf8 strings.

Closes apache#8230 from sagnikc-dremio/concat and squashes the following commits:

e877f37 <Sagnik Chakraborty> ARROW-10050:  Implement concat() in Gandiva for up to 10 arguments

Authored-by: Sagnik Chakraborty <[email protected]>
Signed-off-by: Praveen <[email protected]>
  • Loading branch information
sgnkc authored and GeorgeAp committed Jun 7, 2021
1 parent ff042e8 commit d7e160f
Show file tree
Hide file tree
Showing 4 changed files with 766 additions and 1 deletion.
73 changes: 73 additions & 0 deletions cpp/src/gandiva/function_registry_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,84 @@ std::vector<NativeFunction> GetStringFunctionRegistry() {
NativeFunction("concatOperator", {}, DataTypeVector{utf8(), utf8()}, utf8(),
kResultNullIfNull, "concatOperator_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {}, DataTypeVector{utf8(), utf8(), utf8()}, utf8(),
kResultNullIfNull, "concatOperator_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {}, DataTypeVector{utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullIfNull, "concatOperator_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8()}, utf8(),
kResultNullIfNull, "concatOperator_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullIfNull,
"concatOperator_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction(
"concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8()}, utf8(),
kResultNullIfNull, "concatOperator_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction(
"concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullIfNull,
"concatOperator_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(),
utf8(), utf8(), utf8()},
utf8(), kResultNullIfNull,
"concatOperator_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concatOperator", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(),
utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullIfNull,
"concatOperator_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),

// concat treats null inputs as empty strings whereas concatOperator returns null if
// one of the inputs is null
NativeFunction("concat", {}, DataTypeVector{utf8(), utf8()}, utf8(),
kResultNullNever, "concat_utf8_utf8", NativeFunction::kNeedsContext),
NativeFunction("concat", {}, DataTypeVector{utf8(), utf8(), utf8()}, utf8(),
kResultNullNever, "concat_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concat", {}, DataTypeVector{utf8(), utf8(), utf8(), utf8()}, utf8(),
kResultNullNever, "concat_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concat", {}, DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullNever, "concat_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concat", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullNever, "concat_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction(
"concat", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8()}, utf8(),
kResultNullNever, "concat_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction(
"concat", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullNever, "concat_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concat", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(),
utf8(), utf8(), utf8()},
utf8(), kResultNullNever,
"concat_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),
NativeFunction("concat", {},
DataTypeVector{utf8(), utf8(), utf8(), utf8(), utf8(), utf8(),
utf8(), utf8(), utf8(), utf8()},
utf8(), kResultNullNever,
"concat_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8_utf8",
NativeFunction::kNeedsContext),

NativeFunction("convert_fromUTF8", {"convert_fromutf8"}, DataTypeVector{binary()},
utf8(), kResultNullIfNull, "convert_fromUTF8_binary",
Expand Down
Loading

0 comments on commit d7e160f

Please sign in to comment.