You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/04/29 06:49:50 UTC

[doris] branch branch-1.2-lts updated: [Fix](UT) fix be ut fail #19166

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 6a75774787 [Fix](UT) fix be ut fail #19166
6a75774787 is described below

commit 6a757747878602738e1cf8db5572e463aef2ec4e
Author: GoGoWen <82...@users.noreply.github.com>
AuthorDate: Sat Apr 29 14:49:43 2023 +0800

    [Fix](UT) fix be ut fail #19166
---
 be/test/vec/function/function_jsonb_test.cpp | 332 ++++++++++++++-------------
 1 file changed, 177 insertions(+), 155 deletions(-)

diff --git a/be/test/vec/function/function_jsonb_test.cpp b/be/test/vec/function/function_jsonb_test.cpp
index 7f1fd480e5..5eadc239dc 100644
--- a/be/test/vec/function/function_jsonb_test.cpp
+++ b/be/test/vec/function/function_jsonb_test.cpp
@@ -1202,54 +1202,63 @@ TEST(FunctionJsonbTEST, JsonbExtractDoubleTest) {
 
 TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
     std::string func_name = "CAST";
-    InputTypeSet input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::String}};
+    InputTypeSet input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::UInt8}};
 
     // cast to boolean
     DataSet data_set = {
-            {{STRING("null"), STRING("UInt8")}, Null()},
-            {{STRING("true"), STRING("UInt8")}, BOOLEAN(1)},
-            {{STRING("false"), STRING("UInt8")}, BOOLEAN(0)},
-            {{STRING("100"), STRING("UInt8")}, Null()},                        //int8
-            {{STRING("10000"), STRING("UInt8")}, Null()},                      // int16
-            {{STRING("1000000000"), STRING("UInt8")}, Null()},                 // int32
-            {{STRING("1152921504606846976"), STRING("UInt8")}, Null()},        // int64
-            {{STRING("6.18"), STRING("UInt8")}, Null()},                       // double
-            {{STRING(R"("abcd")"), STRING("UInt8")}, Null()},                  // string
-            {{STRING("{}"), STRING("UInt8")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("UInt8")}, Null()}, // object
-            {{STRING("[]"), STRING("UInt8")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("UInt8")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("UInt8")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("UInt8")},
+            {{STRING("null"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},
+            {{STRING("true"), static_cast<uint8_t>(TypeIndex::UInt8)}, BOOLEAN(1)},
+            {{STRING("false"), static_cast<uint8_t>(TypeIndex::UInt8)}, BOOLEAN(0)},
+            {{STRING("100"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},        //int8
+            {{STRING("10000"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},      // int16
+            {{STRING("1000000000"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()}, // int32
+            {{STRING("1152921504606846976"), static_cast<uint8_t>(TypeIndex::UInt8)},
+             Null()},                                                                // int64
+            {{STRING("6.18"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},      // double
+            {{STRING(R"("abcd")"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()}, // string
+            {{STRING("{}"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},        // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast<uint8_t>(TypeIndex::UInt8)},
+             Null()},                                                                 // object
+            {{STRING("[]"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()},         // empty array
+            {{STRING("[123, 456]"), static_cast<uint8_t>(TypeIndex::UInt8)}, Null()}, // int array
+            {{STRING(R"(["abc", "def"])"), static_cast<uint8_t>(TypeIndex::UInt8)},
+             Null()}, // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"),
+              static_cast<uint8_t>(TypeIndex::UInt8)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("UInt8")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"),
+              static_cast<uint8_t>(TypeIndex::UInt8)},
              Null()}, // complex array
     };
-
     for (const auto& row : data_set) {
         DataSet const_dataset = {row};
         check_function<DataTypeUInt8, true>(func_name, input_types, const_dataset);
     }
-
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int8}};
     // cast to TINYINT
     data_set = {
-            {{STRING("null"), STRING("Int8")}, Null()},
-            {{STRING("true"), STRING("Int8")}, Null()},
-            {{STRING("false"), STRING("Int8")}, Null()},
-            {{STRING("100"), STRING("Int8")}, TINYINT(100)},                  //int8
-            {{STRING("10000"), STRING("Int8")}, Null()},                      // int16
-            {{STRING("1000000000"), STRING("Int8")}, Null()},                 // int32
-            {{STRING("1152921504606846976"), STRING("Int8")}, Null()},        // int64
-            {{STRING("6.18"), STRING("Int8")}, Null()},                       // double
-            {{STRING(R"("abcd")"), STRING("Int8")}, Null()},                  // string
-            {{STRING("{}"), STRING("Int8")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("Int8")}, Null()}, // object
-            {{STRING("[]"), STRING("Int8")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("Int8")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("Int8")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("Int8")},
+            {{STRING("null"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},
+            {{STRING("true"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},
+            {{STRING("false"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},
+            {{STRING("100"), static_cast<int8_t>(TypeIndex::Int8)}, TINYINT(100)},  //int8
+            {{STRING("10000"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},      // int16
+            {{STRING("1000000000"), static_cast<int8_t>(TypeIndex::Int8)}, Null()}, // int32
+            {{STRING("1152921504606846976"), static_cast<int8_t>(TypeIndex::Int8)},
+             Null()},                                                              // int64
+            {{STRING("6.18"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},      // double
+            {{STRING(R"("abcd")"), static_cast<int8_t>(TypeIndex::Int8)}, Null()}, // string
+            {{STRING("{}"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},        // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast<int8_t>(TypeIndex::Int8)},
+             Null()},                                                               // object
+            {{STRING("[]"), static_cast<int8_t>(TypeIndex::Int8)}, Null()},         // empty array
+            {{STRING("[123, 456]"), static_cast<int8_t>(TypeIndex::Int8)}, Null()}, // int array
+            {{STRING(R"(["abc", "def"])"), static_cast<int8_t>(TypeIndex::Int8)},
+             Null()}, // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"),
+              static_cast<int8_t>(TypeIndex::Int8)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("Int8")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"),
+              static_cast<int8_t>(TypeIndex::Int8)},
              Null()}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1257,25 +1266,31 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
         check_function<DataTypeInt8, true>(func_name, input_types, const_dataset);
     }
 
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int16}};
     // cast to SMALLINT
     data_set = {
-            {{STRING("null"), STRING("Int16")}, Null()},
-            {{STRING("true"), STRING("Int16")}, Null()},
-            {{STRING("false"), STRING("Int16")}, Null()},
-            {{STRING("100"), STRING("Int16")}, SMALLINT(100)},                 //int8
-            {{STRING("10000"), STRING("Int16")}, SMALLINT(10000)},             // int16
-            {{STRING("1000000000"), STRING("Int16")}, Null()},                 // int32
-            {{STRING("1152921504606846976"), STRING("Int16")}, Null()},        // int64
-            {{STRING("6.18"), STRING("Int16")}, Null()},                       // double
-            {{STRING(R"("abcd")"), STRING("Int16")}, Null()},                  // string
-            {{STRING("{}"), STRING("Int16")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("Int16")}, Null()}, // object
-            {{STRING("[]"), STRING("Int16")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("Int16")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("Int16")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("Int16")},
+            {{STRING("null"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},
+            {{STRING("true"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},
+            {{STRING("false"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},
+            {{STRING("100"), static_cast<int16_t>(TypeIndex::Int16)}, SMALLINT(100)},     //int8
+            {{STRING("10000"), static_cast<int16_t>(TypeIndex::Int16)}, SMALLINT(10000)}, // int16
+            {{STRING("1000000000"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},     // int32
+            {{STRING("1152921504606846976"), static_cast<int16_t>(TypeIndex::Int16)},
+             Null()},                                                                // int64
+            {{STRING("6.18"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},      // double
+            {{STRING(R"("abcd")"), static_cast<int16_t>(TypeIndex::Int16)}, Null()}, // string
+            {{STRING("{}"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},        // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast<int16_t>(TypeIndex::Int16)},
+             Null()},                                                                 // object
+            {{STRING("[]"), static_cast<int16_t>(TypeIndex::Int16)}, Null()},         // empty array
+            {{STRING("[123, 456]"), static_cast<int16_t>(TypeIndex::Int16)}, Null()}, // int array
+            {{STRING(R"(["abc", "def"])"), static_cast<int16_t>(TypeIndex::Int16)},
+             Null()}, // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"),
+              static_cast<int16_t>(TypeIndex::Int16)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("Int16")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"),
+              static_cast<int16_t>(TypeIndex::Int16)},
              Null()}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1283,25 +1298,32 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
         check_function<DataTypeInt16, true>(func_name, input_types, const_dataset);
     }
 
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int32}};
     // cast to INT
     data_set = {
-            {{STRING("null"), STRING("Int32")}, Null()},
-            {{STRING("true"), STRING("Int32")}, Null()},
-            {{STRING("false"), STRING("Int32")}, Null()},
-            {{STRING("100"), STRING("Int32")}, INT(100)},                      //int8
-            {{STRING("10000"), STRING("Int32")}, INT(10000)},                  // int16
-            {{STRING("1000000000"), STRING("Int32")}, INT(1000000000)},        // int32
-            {{STRING("1152921504606846976"), STRING("Int32")}, Null()},        // int64
-            {{STRING("6.18"), STRING("Int32")}, Null()},                       // double
-            {{STRING(R"("abcd")"), STRING("Int32")}, Null()},                  // string
-            {{STRING("{}"), STRING("Int32")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("Int32")}, Null()}, // object
-            {{STRING("[]"), STRING("Int32")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("Int32")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("Int32")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("Int32")},
+            {{STRING("null"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},
+            {{STRING("true"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},
+            {{STRING("false"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},
+            {{STRING("100"), static_cast<int32_t>(TypeIndex::Int32)}, INT(100)},     //int8
+            {{STRING("10000"), static_cast<int32_t>(TypeIndex::Int32)}, INT(10000)}, // int16
+            {{STRING("1000000000"), static_cast<int32_t>(TypeIndex::Int32)},
+             INT(1000000000)}, // int32
+            {{STRING("1152921504606846976"), static_cast<int32_t>(TypeIndex::Int32)},
+             Null()},                                                                // int64
+            {{STRING("6.18"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},      // double
+            {{STRING(R"("abcd")"), static_cast<int32_t>(TypeIndex::Int32)}, Null()}, // string
+            {{STRING("{}"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},        // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast<int32_t>(TypeIndex::Int32)},
+             Null()},                                                                 // object
+            {{STRING("[]"), static_cast<int32_t>(TypeIndex::Int32)}, Null()},         // empty array
+            {{STRING("[123, 456]"), static_cast<int32_t>(TypeIndex::Int32)}, Null()}, // int array
+            {{STRING(R"(["abc", "def"])"), static_cast<int32_t>(TypeIndex::Int32)},
+             Null()}, // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"),
+              static_cast<int32_t>(TypeIndex::Int32)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("Int32")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"),
+              static_cast<int32_t>(TypeIndex::Int32)},
              Null()}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1309,26 +1331,26 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
         check_function<DataTypeInt32, true>(func_name, input_types, const_dataset);
     }
 
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int64}};
     // cast to BIGINT
     data_set = {
-            {{STRING("null"), STRING("Int64")}, Null()},
-            {{STRING("true"), STRING("Int64")}, Null()},
-            {{STRING("false"), STRING("Int64")}, Null()},
-            {{STRING("100"), STRING("Int64")}, BIGINT(100)},               //int8
-            {{STRING("10000"), STRING("Int64")}, BIGINT(10000)},           // int16
-            {{STRING("1000000000"), STRING("Int64")}, BIGINT(1000000000)}, // int32
-            {{STRING("1152921504606846976"), STRING("Int64")},
-             BIGINT(1152921504606846976)},                                     // int64
-            {{STRING("6.18"), STRING("Int64")}, Null()},                       // double
-            {{STRING(R"("abcd")"), STRING("Int64")}, Null()},                  // string
-            {{STRING("{}"), STRING("Int64")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("Int64")}, Null()}, // object
-            {{STRING("[]"), STRING("Int64")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("Int64")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("Int64")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("Int64")},
+            {{STRING("null"), BIGINT(1)}, Null()},
+            {{STRING("true"), BIGINT(1)}, Null()},
+            {{STRING("false"), BIGINT(1)}, Null()},
+            {{STRING("100"), BIGINT(1)}, BIGINT(100)},                                 //int8
+            {{STRING("10000"), BIGINT(1)}, BIGINT(10000)},                             // int16
+            {{STRING("1000000000"), BIGINT(1)}, BIGINT(1000000000)},                   // int32
+            {{STRING("1152921504606846976"), BIGINT(1)}, BIGINT(1152921504606846976)}, // int64
+            {{STRING("6.18"), BIGINT(1)}, Null()},                                     // double
+            {{STRING(R"("abcd")"), BIGINT(1)}, Null()},                                // string
+            {{STRING("{}"), BIGINT(1)}, Null()},                         // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), BIGINT(1)}, Null()}, // object
+            {{STRING("[]"), BIGINT(1)}, Null()},                         // empty array
+            {{STRING("[123, 456]"), BIGINT(1)}, Null()},                 // int array
+            {{STRING(R"(["abc", "def"])"), BIGINT(1)}, Null()},          // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), BIGINT(1)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("Int64")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), BIGINT(1)},
              Null()}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1336,26 +1358,26 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
         check_function<DataTypeInt64, true>(func_name, input_types, const_dataset);
     }
 
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Float64}};
     // cast to DOUBLE
     data_set = {
-            {{STRING("null"), STRING("Float64")}, Null()},
-            {{STRING("true"), STRING("Float64")}, Null()},
-            {{STRING("false"), STRING("Float64")}, Null()},
-            {{STRING("100"), STRING("Float64")}, DOUBLE(100)},               //int8
-            {{STRING("10000"), STRING("Float64")}, DOUBLE(10000)},           // int16
-            {{STRING("1000000000"), STRING("Float64")}, DOUBLE(1000000000)}, // int32
-            {{STRING("1152921504606846976"), STRING("Float64")},
-             DOUBLE(1152921504606846976)},                                       // int64
-            {{STRING("6.18"), STRING("Float64")}, DOUBLE(6.18)},                 // double
-            {{STRING(R"("abcd")"), STRING("Float64")}, Null()},                  // string
-            {{STRING("{}"), STRING("Float64")}, Null()},                         // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("Float64")}, Null()}, // object
-            {{STRING("[]"), STRING("Float64")}, Null()},                         // empty array
-            {{STRING("[123, 456]"), STRING("Float64")}, Null()},                 // int array
-            {{STRING(R"(["abc", "def"])"), STRING("Float64")}, Null()},          // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("Float64")},
+            {{STRING("null"), DOUBLE(1)}, Null()},
+            {{STRING("true"), DOUBLE(1)}, Null()},
+            {{STRING("false"), DOUBLE(1)}, Null()},
+            {{STRING("100"), DOUBLE(1)}, DOUBLE(100)},                                 //int8
+            {{STRING("10000"), DOUBLE(1)}, DOUBLE(10000)},                             // int16
+            {{STRING("1000000000"), DOUBLE(1)}, DOUBLE(1000000000)},                   // int32
+            {{STRING("1152921504606846976"), DOUBLE(1)}, DOUBLE(1152921504606846976)}, // int64
+            {{STRING("6.18"), DOUBLE(1)}, DOUBLE(6.18)},                               // double
+            {{STRING(R"("abcd")"), DOUBLE(1)}, Null()},                                // string
+            {{STRING("{}"), DOUBLE(1)}, Null()},                         // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), DOUBLE(1)}, Null()}, // object
+            {{STRING("[]"), DOUBLE(1)}, Null()},                         // empty array
+            {{STRING("[123, 456]"), DOUBLE(1)}, Null()},                 // int array
+            {{STRING(R"(["abc", "def"])"), DOUBLE(1)}, Null()},          // string array
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), DOUBLE(1)},
              Null()}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("Float64")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), DOUBLE(1)},
              Null()}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1363,28 +1385,28 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
         check_function<DataTypeFloat64, true>(func_name, input_types, const_dataset);
     }
 
+    input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::String}};
     // cast to STRING
     data_set = {
-            {{STRING("null"), STRING("String")}, STRING("null")},
-            {{STRING("true"), STRING("String")}, STRING("true")},
-            {{STRING("false"), STRING("String")}, STRING("false")},
-            {{STRING("100"), STRING("String")}, STRING("100")},               //int8
-            {{STRING("10000"), STRING("String")}, STRING("10000")},           // int16
-            {{STRING("1000000000"), STRING("String")}, STRING("1000000000")}, // int32
-            {{STRING("1152921504606846976"), STRING("String")},
-             STRING("1152921504606846976")},                                // int64
-            {{STRING("6.18"), STRING("String")}, STRING("6.18")},           // double
-            {{STRING(R"("abcd")"), STRING("String")}, STRING(R"("abcd")")}, // string
-            {{STRING("{}"), STRING("String")}, STRING("{}")},               // empty object
-            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("String")},
-             STRING(R"({"k1":"v31","k2":300})")},                            // object
-            {{STRING("[]"), STRING("String")}, STRING("[]")},                // empty array
-            {{STRING("[123, 456]"), STRING("String")}, STRING("[123,456]")}, // int array
-            {{STRING(R"(["abc", "def"])"), STRING("String")},
+            {{STRING("null"), STRING("1")}, STRING("null")},
+            {{STRING("true"), STRING("1")}, STRING("true")},
+            {{STRING("false"), STRING("1")}, STRING("false")},
+            {{STRING("100"), STRING("1")}, STRING("100")},                                 //int8
+            {{STRING("10000"), STRING("1")}, STRING("10000")},                             // int16
+            {{STRING("1000000000"), STRING("1")}, STRING("1000000000")},                   // int32
+            {{STRING("1152921504606846976"), STRING("1")}, STRING("1152921504606846976")}, // int64
+            {{STRING("6.18"), STRING("1")}, STRING("6.18")},                               // double
+            {{STRING(R"("abcd")"), STRING("1")}, STRING(R"("abcd")")},                     // string
+            {{STRING("{}"), STRING("1")}, STRING("{}")}, // empty object
+            {{STRING(R"({"k1":"v31", "k2": 300})"), STRING("1")},
+             STRING(R"({"k1":"v31","k2":300})")},                       // object
+            {{STRING("[]"), STRING("1")}, STRING("[]")},                // empty array
+            {{STRING("[123, 456]"), STRING("1")}, STRING("[123,456]")}, // int array
+            {{STRING(R"(["abc", "def"])"), STRING("1")},
              STRING(R"(["abc","def"])")}, // string array
-            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("String")},
+            {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), STRING("1")},
              STRING(R"([null,true,false,100,6.18,"abc"])")}, // multi type array
-            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("String")},
+            {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), STRING("1")},
              STRING(R"([{"k1":"v41","k2":400},1,"a",3.14])")}, // complex array
     };
     for (const auto& row : data_set) {
@@ -1396,62 +1418,62 @@ TEST(FunctionJsonbTEST, JsonbCastToOtherTest) {
 TEST(FunctionJsonbTEST, JsonbCastFromOtherTest) {
     // CAST Nullable(X) to Nullable(JSONB)
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::String}},
-            {{{BOOLEAN(1), STRING("Jsonb")}, STRING("true")}});
+            "CAST", {Nullable {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BOOLEAN(1), Null()}, STRING("true")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::String}},
-            {{{BOOLEAN(0), STRING("Jsonb")}, STRING("false")}});
+            "CAST", {Nullable {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BOOLEAN(0), Null()}, STRING("false")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::Int8}, ConstedNotnull {TypeIndex::String}},
-            {{{TINYINT(100), STRING("Jsonb")}, STRING("100")}});
+            "CAST", {Nullable {TypeIndex::Int8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{TINYINT(100), Null()}, STRING("100")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::Int16}, ConstedNotnull {TypeIndex::String}},
-            {{{SMALLINT(10000), STRING("Jsonb")}, STRING("10000")}});
+            "CAST", {Nullable {TypeIndex::Int16}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{SMALLINT(10000), Null()}, STRING("10000")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::Int32}, ConstedNotnull {TypeIndex::String}},
-            {{{INT(1000000000), STRING("Jsonb")}, STRING("1000000000")}});
+            "CAST", {Nullable {TypeIndex::Int32}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{INT(1000000000), Null()}, STRING("1000000000")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::Int64}, ConstedNotnull {TypeIndex::String}},
-            {{{BIGINT(1152921504606846976), STRING("Jsonb")}, STRING("1152921504606846976")}});
+            "CAST", {Nullable {TypeIndex::Int64}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BIGINT(1152921504606846976), Null()}, STRING("1152921504606846976")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::Float64}, ConstedNotnull {TypeIndex::String}},
-            {{{DOUBLE(6.18), STRING("Jsonb")}, STRING("6.18")}});
+            "CAST", {Nullable {TypeIndex::Float64}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{DOUBLE(6.18), Null()}, STRING("6.18")}});
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::String}, ConstedNotnull {TypeIndex::String}},
-            {{{STRING(R"(abcd)"), STRING("Jsonb")}, Null()}}); // should fail
+            "CAST", {Nullable {TypeIndex::String}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{STRING(R"(abcd)"), Null()}, Null()}}); // should fail
     check_function<DataTypeJsonb, true>(
-            "CAST", {Nullable {TypeIndex::String}, ConstedNotnull {TypeIndex::String}},
-            {{{STRING(R"("abcd")"), STRING("Jsonb")}, STRING(R"("abcd")")}});
+            "CAST", {Nullable {TypeIndex::String}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{STRING(R"("abcd")"), Null()}, STRING(R"("abcd")")}});
 
     // CAST X to JSONB
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::String}},
-            {{{BOOLEAN(1), STRING("Jsonb")}, STRING("true")}});
+            "CAST", {Notnull {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BOOLEAN(1), Null()}, STRING("true")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::String}},
-            {{{BOOLEAN(0), STRING("Jsonb")}, STRING("false")}});
+            "CAST", {Notnull {TypeIndex::UInt8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BOOLEAN(0), Null()}, STRING("false")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::Int8}, ConstedNotnull {TypeIndex::String}},
-            {{{TINYINT(100), STRING("Jsonb")}, STRING("100")}});
+            "CAST", {Notnull {TypeIndex::Int8}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{TINYINT(100), Null()}, STRING("100")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::Int16}, ConstedNotnull {TypeIndex::String}},
-            {{{SMALLINT(10000), STRING("Jsonb")}, STRING("10000")}});
+            "CAST", {Notnull {TypeIndex::Int16}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{SMALLINT(10000), Null()}, STRING("10000")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::Int32}, ConstedNotnull {TypeIndex::String}},
-            {{{INT(1000000000), STRING("Jsonb")}, STRING("1000000000")}});
+            "CAST", {Notnull {TypeIndex::Int32}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{INT(1000000000), Null()}, STRING("1000000000")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::Int64}, ConstedNotnull {TypeIndex::String}},
-            {{{BIGINT(1152921504606846976), STRING("Jsonb")}, STRING("1152921504606846976")}});
+            "CAST", {Notnull {TypeIndex::Int64}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{BIGINT(1152921504606846976), Null()}, STRING("1152921504606846976")}});
     check_function<DataTypeJsonb, false>(
-            "CAST", {Notnull {TypeIndex::Float64}, ConstedNotnull {TypeIndex::String}},
-            {{{DOUBLE(6.18), STRING("Jsonb")}, STRING("6.18")}});
+            "CAST", {Notnull {TypeIndex::Float64}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{DOUBLE(6.18), Null()}, STRING("6.18")}});
     // String to JSONB should always be Nullable
     check_function<DataTypeJsonb, true>(
-            "CAST", {Notnull {TypeIndex::String}, ConstedNotnull {TypeIndex::String}},
-            {{{STRING(R"(abcd)"), STRING("Jsonb")}, Null()}}); // should fail
+            "CAST", {Notnull {TypeIndex::String}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{STRING(R"(abcd)"), Null()}, Null()}}); // should fail
     check_function<DataTypeJsonb, true>(
-            "CAST", {Notnull {TypeIndex::String}, ConstedNotnull {TypeIndex::String}},
-            {{{STRING(R"("abcd")"), STRING("Jsonb")}, STRING(R"("abcd")")}});
+            "CAST", {Notnull {TypeIndex::String}, ConstedNotnull {TypeIndex::JSONB}},
+            {{{STRING(R"("abcd")"), Null()}, STRING(R"("abcd")")}});
 }
 
 } // namespace doris::vectorized


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org