[fix](executor) make elt / repeat smooth upgrade. (#21493)

BE : 2.0,FE : 1.2

before

mysql [(none)]>select elt(1, 'aaa', 'bbb');
ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[INTERNAL_ERROR]Function elt get failed, expr is VectorizedFnCall[elt](arguments=,return=String) and return type is String.

mysql [test]> INSERT INTO tbb VALUES (1, repeat("test1111", 8192))(2, repeat("test1111", 131072));
mysql [test]>select k1, md5(v1), length(v1) from tbb;
+------+----------------------------------+--------------+
| k1   | md5(`v1`)                        | length(`v1`) |
+------+----------------------------------+--------------+
| 1    | d41d8cd98f00b204e9800998ecf8427e |            0 |
| 2    | d41d8cd98f00b204e9800998ecf8427e |            0 |
+------+----------------------------------+--------------+

now

mysql [test]>select elt(1, 'aaa', 'bbb');
+----------------------+
| elt(1, 'aaa', 'bbb') |
+----------------------+
| aaa                  |
+----------------------+

mysql [test]>select k1, md5(v1), length(v1) from tbb;
+------+----------------------------------+--------------+
| k1   | md5(`v1`)                        | length(`v1`) |
+------+----------------------------------+--------------+
| 1    | 1f44fb91f47cab16f711973af06294a0 |        65536 |
| 2    | 3c514d3b89e26e2f983b7bd4cbb82055 |      1048576 |
+------+----------------------------------+--------------+
This commit is contained in:
Mryange
2023-07-06 19:15:06 +08:00
committed by GitHub
parent 2d94477748
commit 181dad4181
3 changed files with 63 additions and 7 deletions

View File

@ -965,7 +965,7 @@ void register_function_string(SimpleFunctionFactory& factory) {
factory.register_function<FunctionStringElt>();
factory.register_function<FunctionStringConcatWs>();
factory.register_function<FunctionStringAppendTrailingCharIfAbsent>();
factory.register_function<FunctionStringRepeat>();
factory.register_function<FunctionStringRepeat<false>>();
factory.register_function<FunctionStringLPad>();
factory.register_function<FunctionStringRPad>();
factory.register_function<FunctionToBase64>();
@ -996,6 +996,10 @@ void register_function_string(SimpleFunctionFactory& factory) {
factory.register_alias(FunctionStringMd5AndSM3<MD5Sum>::name, "md5");
factory.register_alias(FunctionStringUTF8Length::name, "character_length");
factory.register_alias(FunctionStringMd5AndSM3<SM3Sum>::name, "sm3");
/// @TEMPORARY: for be_exec_version=2
factory.register_alternative_function<FunctionStringEltOld>();
factory.register_alternative_function<FunctionStringRepeat<true>>();
}
} // namespace doris::vectorized