[Function](ELT)Add elt function (#12321)

This commit is contained in:
yongjinhou
2022-09-07 15:21:08 +08:00
committed by GitHub
parent f2923f9180
commit 09b45f2b71
11 changed files with 256 additions and 0 deletions

View File

@ -682,6 +682,15 @@ StringVal StringFunctions::concat_ws(FunctionContext* context, const StringVal&
return result;
}
StringVal StringFunctions::elt(FunctionContext* context, const IntVal& pos, int num_children,
const StringVal* strs) {
if (pos.is_null || pos.val < 1 || num_children == 0 || pos.val > num_children) {
return StringVal::null();
}
return strs[pos.val - 1];
}
IntVal StringFunctions::find_in_set(FunctionContext* context, const StringVal& str,
const StringVal& str_set) {
if (str.is_null || str_set.is_null) {