From 773008d6fa4362a4ea6d3204449efbce700332b6 Mon Sep 17 00:00:00 2001 From: lihangyu <15605149486@163.com> Date: Wed, 7 Aug 2024 22:05:43 +0800 Subject: [PATCH] [Fix](Json) fix some cast issue (#38683) (#39025) #38683 --- be/src/vec/functions/function_cast.h | 27 ++- be/test/vec/function/function_jsonb_test.cpp | 223 ------------------ .../data/datatype_p0/json/json_cast.out | 37 ++- .../json_p0/test_json_load_and_function.out | 76 +++--- ...test_json_load_unique_key_and_function.out | 64 ++--- .../jsonb_p0/test_jsonb_load_and_function.out | 76 +++--- ...est_jsonb_load_unique_key_and_function.out | 64 ++--- .../nereids_function_p0/scalar_function/J.out | 76 +++--- .../json_p0/test_json_load_and_function.out | 76 +++--- ...test_json_load_unique_key_and_function.out | 64 ++--- ...est_jsonb_load_unique_key_and_function.out | 64 ++--- .../suites/datatype_p0/json/json_cast.groovy | 14 ++ 12 files changed, 354 insertions(+), 507 deletions(-) diff --git a/be/src/vec/functions/function_cast.h b/be/src/vec/functions/function_cast.h index eee6b9cbfa..acb267b83e 100644 --- a/be/src/vec/functions/function_cast.h +++ b/be/src/vec/functions/function_cast.h @@ -863,12 +863,19 @@ struct ConvertImplFromJsonb { res[i] = 0; continue; } - if constexpr (type_index == TypeIndex::UInt8) { + // cast from json value to boolean type if (value->isTrue()) { res[i] = 1; } else if (value->isFalse()) { res[i] = 0; + } else if (value->isInt()) { + res[i] = ((const JsonbIntVal*)value)->val() == 0 ? 0 : 1; + } else if (value->isDouble()) { + res[i] = static_cast( + ((const JsonbDoubleVal*)value)->val()) == 0 + ? 0 + : 1; } else { null_map[i] = 1; res[i] = 0; @@ -878,15 +885,31 @@ struct ConvertImplFromJsonb { type_index == TypeIndex::Int32 || type_index == TypeIndex::Int64 || type_index == TypeIndex::Int128) { + // cast from json value to integer types if (value->isInt()) { res[i] = ((const JsonbIntVal*)value)->val(); + } else if (value->isDouble()) { + res[i] = static_cast( + ((const JsonbDoubleVal*)value)->val()); + } else if (value->isTrue()) { + res[i] = 1; + } else if (value->isFalse()) { + res[i] = 0; } else { null_map[i] = 1; res[i] = 0; } - } else if constexpr (type_index == TypeIndex::Float64) { + } else if constexpr (type_index == TypeIndex::Float64 || + type_index == TypeIndex::Float32) { + // cast from json value to floating point types if (value->isDouble()) { res[i] = ((const JsonbDoubleVal*)value)->val(); + } else if (value->isFloat()) { + res[i] = ((const JsonbFloatVal*)value)->val(); + } else if (value->isTrue()) { + res[i] = 1; + } else if (value->isFalse()) { + res[i] = 0; } else if (value->isInt()) { res[i] = ((const JsonbIntVal*)value)->val(); } else { diff --git a/be/test/vec/function/function_jsonb_test.cpp b/be/test/vec/function/function_jsonb_test.cpp index 91206028ef..03887d855e 100644 --- a/be/test/vec/function/function_jsonb_test.cpp +++ b/be/test/vec/function/function_jsonb_test.cpp @@ -1230,229 +1230,6 @@ TEST(FunctionJsonbTEST, JsonbExtractDoubleTest) { static_cast(check_function(func_name, input_types, data_set)); } -TEST(FunctionJsonbTEST, JsonbCastToOtherTest) { - std::string func_name = "CAST"; - InputTypeSet input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::UInt8}}; - - // cast to boolean - DataSet data_set = { - {{STRING("null"), static_cast(TypeIndex::UInt8)}, Null()}, - {{STRING("true"), static_cast(TypeIndex::UInt8)}, BOOLEAN(1)}, - {{STRING("false"), static_cast(TypeIndex::UInt8)}, BOOLEAN(0)}, - {{STRING("100"), static_cast(TypeIndex::UInt8)}, Null()}, //int8 - {{STRING("10000"), static_cast(TypeIndex::UInt8)}, Null()}, // int16 - {{STRING("1000000000"), static_cast(TypeIndex::UInt8)}, Null()}, // int32 - {{STRING("1152921504606846976"), static_cast(TypeIndex::UInt8)}, - Null()}, // int64 - {{STRING("6.18"), static_cast(TypeIndex::UInt8)}, Null()}, // double - {{STRING(R"("abcd")"), static_cast(TypeIndex::UInt8)}, Null()}, // string - {{STRING("{}"), static_cast(TypeIndex::UInt8)}, Null()}, // empty object - {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast(TypeIndex::UInt8)}, - Null()}, // object - {{STRING("[]"), static_cast(TypeIndex::UInt8)}, Null()}, // empty array - {{STRING("[123, 456]"), static_cast(TypeIndex::UInt8)}, Null()}, // int array - {{STRING(R"(["abc", "def"])"), static_cast(TypeIndex::UInt8)}, - Null()}, // string array - {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), - static_cast(TypeIndex::UInt8)}, - Null()}, // multi type array - {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), - static_cast(TypeIndex::UInt8)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int8}}; - // cast to TINYINT - data_set = { - {{STRING("null"), static_cast(TypeIndex::Int8)}, Null()}, - {{STRING("true"), static_cast(TypeIndex::Int8)}, Null()}, - {{STRING("false"), static_cast(TypeIndex::Int8)}, Null()}, - {{STRING("100"), static_cast(TypeIndex::Int8)}, TINYINT(100)}, //int8 - {{STRING("10000"), static_cast(TypeIndex::Int8)}, TINYINT(16)}, // int16 - {{STRING("1000000000"), static_cast(TypeIndex::Int8)}, TINYINT(0)}, // int32 - {{STRING("1152921504606846976"), static_cast(TypeIndex::Int8)}, - TINYINT(0)}, // int64 - {{STRING("6.18"), static_cast(TypeIndex::Int8)}, Null()}, // double - {{STRING(R"("abcd")"), static_cast(TypeIndex::Int8)}, Null()}, // string - {{STRING("{}"), static_cast(TypeIndex::Int8)}, Null()}, // empty object - {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast(TypeIndex::Int8)}, - Null()}, // object - {{STRING("[]"), static_cast(TypeIndex::Int8)}, Null()}, // empty array - {{STRING("[123, 456]"), static_cast(TypeIndex::Int8)}, Null()}, // int array - {{STRING(R"(["abc", "def"])"), static_cast(TypeIndex::Int8)}, - Null()}, // string array - {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), - static_cast(TypeIndex::Int8)}, - Null()}, // multi type array - {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), - static_cast(TypeIndex::Int8)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int16}}; - // cast to SMALLINT - data_set = { - {{STRING("null"), static_cast(TypeIndex::Int16)}, Null()}, - {{STRING("true"), static_cast(TypeIndex::Int16)}, Null()}, - {{STRING("false"), static_cast(TypeIndex::Int16)}, Null()}, - {{STRING("100"), static_cast(TypeIndex::Int16)}, SMALLINT(100)}, //int8 - {{STRING("10000"), static_cast(TypeIndex::Int16)}, SMALLINT(10000)}, // int16 - {{STRING("1000000000"), static_cast(TypeIndex::Int16)}, - SMALLINT(-13824)}, // int32 - {{STRING("1152921504606846976"), static_cast(TypeIndex::Int16)}, - SMALLINT(0)}, // int64 - {{STRING("6.18"), static_cast(TypeIndex::Int16)}, Null()}, // double - {{STRING(R"("abcd")"), static_cast(TypeIndex::Int16)}, Null()}, // string - {{STRING("{}"), static_cast(TypeIndex::Int16)}, Null()}, // empty object - {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast(TypeIndex::Int16)}, - Null()}, // object - {{STRING("[]"), static_cast(TypeIndex::Int16)}, Null()}, // empty array - {{STRING("[123, 456]"), static_cast(TypeIndex::Int16)}, Null()}, // int array - {{STRING(R"(["abc", "def"])"), static_cast(TypeIndex::Int16)}, - Null()}, // string array - {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), - static_cast(TypeIndex::Int16)}, - Null()}, // multi type array - {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), - static_cast(TypeIndex::Int16)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int32}}; - // cast to INT - data_set = { - {{STRING("null"), static_cast(TypeIndex::Int32)}, Null()}, - {{STRING("true"), static_cast(TypeIndex::Int32)}, Null()}, - {{STRING("false"), static_cast(TypeIndex::Int32)}, Null()}, - {{STRING("100"), static_cast(TypeIndex::Int32)}, INT(100)}, //int8 - {{STRING("10000"), static_cast(TypeIndex::Int32)}, INT(10000)}, // int16 - {{STRING("1000000000"), static_cast(TypeIndex::Int32)}, - INT(1000000000)}, // int32 - {{STRING("1152921504606846976"), static_cast(TypeIndex::Int32)}, - INT(0)}, // int64 - {{STRING("6.18"), static_cast(TypeIndex::Int32)}, Null()}, // double - {{STRING(R"("abcd")"), static_cast(TypeIndex::Int32)}, Null()}, // string - {{STRING("{}"), static_cast(TypeIndex::Int32)}, Null()}, // empty object - {{STRING(R"({"k1":"v31", "k2": 300})"), static_cast(TypeIndex::Int32)}, - Null()}, // object - {{STRING("[]"), static_cast(TypeIndex::Int32)}, Null()}, // empty array - {{STRING("[123, 456]"), static_cast(TypeIndex::Int32)}, Null()}, // int array - {{STRING(R"(["abc", "def"])"), static_cast(TypeIndex::Int32)}, - Null()}, // string array - {{STRING(R"([null, true, false, 100, 6.18, "abc"])"), - static_cast(TypeIndex::Int32)}, - Null()}, // multi type array - {{STRING(R"([{"k1":"v41", "k2": 400}, 1, "a", 3.14])"), - static_cast(TypeIndex::Int32)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Int64}}; - // cast to BIGINT - data_set = { - {{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])"), BIGINT(1)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::Float64}}; - // cast to DOUBLE - data_set = { - {{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])"), DOUBLE(1)}, - Null()}, // complex array - }; - for (const auto& row : data_set) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } - - input_types = {Nullable {TypeIndex::JSONB}, ConstedNotnull {TypeIndex::String}}; - // cast to STRING - data_set = { - {{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("1")}, - STRING(R"([null,true,false,100,6.18,"abc"])")}, // multi type array - {{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) { - DataSet const_dataset = {row}; - static_cast( - check_function(func_name, input_types, const_dataset)); - } -} - TEST(FunctionJsonbTEST, JsonbCastFromOtherTest) { // CAST Nullable(X) to Nullable(JSONB) static_cast(check_function( diff --git a/regression-test/data/datatype_p0/json/json_cast.out b/regression-test/data/datatype_p0/json/json_cast.out index 8f58f45ce7..f7d9363df3 100644 --- a/regression-test/data/datatype_p0/json/json_cast.out +++ b/regression-test/data/datatype_p0/json/json_cast.out @@ -21,13 +21,13 @@ true -- !sql8 -- -\N +1000 -- !sql9 -- 1000.1111 -- !sql10 -- -\N +true -- !sql11 -- ["CXO0N: 1045901740","HMkTa: 1348450505","44 HHD: 915015173","j9WoJ: -1517316688"] @@ -53,3 +53,36 @@ true -- !sql18 -- \N +-- !sql19 -- +1 + +-- !sql19 -- +0 + +-- !sql20 -- +1.0 + +-- !sql20 -- +0.0 + +-- !sql21 -- +true + +-- !sql22 -- +1024.0 + +-- !sql23 -- +1024.0 + +-- !sql24 -- +1024.0 + +-- !sql24 -- +[1,2,3] + +-- !sql25 -- +[1,2,3] + +-- !sql26 -- +["2020-01-01"] + diff --git a/regression-test/data/json_p0/test_json_load_and_function.out b/regression-test/data/json_p0/test_json_load_and_function.out index b7e51e5acc..27a99c8959 100644 --- a/regression-test/data/json_p0/test_json_load_and_function.out +++ b/regression-test/data/json_p0/test_json_load_and_function.out @@ -5716,11 +5716,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5733,9 +5733,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -5743,13 +5743,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5772,13 +5772,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5801,13 +5801,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5830,8 +5830,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -5890,11 +5890,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5907,9 +5907,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -5917,13 +5917,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5946,13 +5946,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5975,13 +5975,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -6004,8 +6004,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/json_p0/test_json_load_unique_key_and_function.out b/regression-test/data/json_p0/test_json_load_unique_key_and_function.out index 3cb34304af..a0a12b2c27 100644 --- a/regression-test/data/json_p0/test_json_load_unique_key_and_function.out +++ b/regression-test/data/json_p0/test_json_load_unique_key_and_function.out @@ -3934,11 +3934,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -3955,13 +3955,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -3978,13 +3978,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4001,13 +4001,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4024,8 +4024,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -4072,11 +4072,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4093,13 +4093,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4116,13 +4116,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4139,13 +4139,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4162,8 +4162,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/jsonb_p0/test_jsonb_load_and_function.out b/regression-test/data/jsonb_p0/test_jsonb_load_and_function.out index 271083fbeb..0c9753215c 100644 --- a/regression-test/data/jsonb_p0/test_jsonb_load_and_function.out +++ b/regression-test/data/jsonb_p0/test_jsonb_load_and_function.out @@ -7714,11 +7714,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7731,9 +7731,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -7741,13 +7741,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7770,13 +7770,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7799,13 +7799,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7828,8 +7828,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -7888,11 +7888,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7905,9 +7905,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -7915,13 +7915,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7944,13 +7944,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7973,13 +7973,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -8002,8 +8002,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/jsonb_p0/test_jsonb_load_unique_key_and_function.out b/regression-test/data/jsonb_p0/test_jsonb_load_unique_key_and_function.out index a9bec25de0..c699a010fc 100644 --- a/regression-test/data/jsonb_p0/test_jsonb_load_unique_key_and_function.out +++ b/regression-test/data/jsonb_p0/test_jsonb_load_unique_key_and_function.out @@ -5521,11 +5521,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5542,13 +5542,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5565,13 +5565,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5588,13 +5588,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5611,8 +5611,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -5659,11 +5659,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5680,13 +5680,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5703,13 +5703,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5726,13 +5726,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5749,8 +5749,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/nereids_function_p0/scalar_function/J.out b/regression-test/data/nereids_function_p0/scalar_function/J.out index 0994891dc7..41606ca51a 100644 --- a/regression-test/data/nereids_function_p0/scalar_function/J.out +++ b/regression-test/data/nereids_function_p0/scalar_function/J.out @@ -6914,11 +6914,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -6931,20 +6931,20 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -6964,13 +6964,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -6990,13 +6990,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7016,8 +7016,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -7070,11 +7070,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7087,20 +7087,20 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7120,13 +7120,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7146,13 +7146,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -7172,8 +7172,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/nereids_p0/json_p0/test_json_load_and_function.out b/regression-test/data/nereids_p0/json_p0/test_json_load_and_function.out index 17a8db24d3..295685a8c0 100644 --- a/regression-test/data/nereids_p0/json_p0/test_json_load_and_function.out +++ b/regression-test/data/nereids_p0/json_p0/test_json_load_and_function.out @@ -5713,11 +5713,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5730,9 +5730,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -5740,13 +5740,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5769,13 +5769,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5798,13 +5798,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5827,8 +5827,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -5887,11 +5887,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5904,9 +5904,9 @@ 26 \N \N 27 {"k1":"v1","k2":200} \N 28 {"a.b.c":{"k1.a1":"v31","k2":300},"a":"niu"} \N -29 12524337771678448270 \N -30 -9223372036854775808 \N -31 18446744073709551615 \N +29 12524337771678448270 true +30 -9223372036854775808 true +31 18446744073709551615 true 32 {"":"v1"} \N 33 {"":1,"":"v1"} \N 34 {"":1,"ab":"v1","":"v1","":2} \N @@ -5914,13 +5914,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5943,13 +5943,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5972,13 +5972,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -6001,8 +6001,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/nereids_p0/json_p0/test_json_load_unique_key_and_function.out b/regression-test/data/nereids_p0/json_p0/test_json_load_unique_key_and_function.out index 3cb34304af..a0a12b2c27 100644 --- a/regression-test/data/nereids_p0/json_p0/test_json_load_unique_key_and_function.out +++ b/regression-test/data/nereids_p0/json_p0/test_json_load_unique_key_and_function.out @@ -3934,11 +3934,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -3955,13 +3955,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -3978,13 +3978,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4001,13 +4001,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4024,8 +4024,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -4072,11 +4072,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4093,13 +4093,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4116,13 +4116,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4139,13 +4139,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -4162,8 +4162,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/data/nereids_p0/jsonb_p0/test_jsonb_load_unique_key_and_function.out b/regression-test/data/nereids_p0/jsonb_p0/test_jsonb_load_unique_key_and_function.out index f69d695d45..12e3742583 100644 --- a/regression-test/data/nereids_p0/jsonb_p0/test_jsonb_load_unique_key_and_function.out +++ b/regression-test/data/nereids_p0/jsonb_p0/test_jsonb_load_unique_key_and_function.out @@ -5521,11 +5521,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5542,13 +5542,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5565,13 +5565,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5588,13 +5588,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5611,8 +5611,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1.0 +4 false 0.0 5 100 100.0 6 10000 10000.0 7 1000000000 1.0E9 @@ -5659,11 +5659,11 @@ 2 null \N 3 true true 4 false false -5 100 \N -6 10000 \N -7 1000000000 \N -8 1152921504606846976 \N -9 6.18 \N +5 100 true +6 10000 true +7 1000000000 true +8 1152921504606846976 true +9 6.18 true 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5680,13 +5680,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 -13824 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5703,13 +5703,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 0 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5726,13 +5726,13 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 8 1152921504606846976 1152921504606846976 -9 6.18 \N +9 6.18 6 10 "abcd" \N 11 {} \N 12 {"k1":"v31","k2":300} \N @@ -5749,8 +5749,8 @@ -- !select -- 1 \N \N 2 null \N -3 true \N -4 false \N +3 true 1 +4 false 0 5 100 100 6 10000 10000 7 1000000000 1000000000 diff --git a/regression-test/suites/datatype_p0/json/json_cast.groovy b/regression-test/suites/datatype_p0/json/json_cast.groovy index 458c60992d..683d9740bd 100644 --- a/regression-test/suites/datatype_p0/json/json_cast.groovy +++ b/regression-test/suites/datatype_p0/json/json_cast.groovy @@ -36,4 +36,18 @@ suite("test_json_type_cast", "p0") { qt_sql16 """select cast("-" as int);""" qt_sql17 """select cast("a" as int);""" qt_sql18 """select cast("/" as int);""" + + qt_sql19 "SELECT CAST(CAST(CAST(1 AS BOOLEAN) AS JSON) as INT)" + qt_sql19 "SELECT CAST(CAST(CAST(0 AS BOOLEAN) AS JSON) as INT)" + qt_sql20 "SELECT CAST(CAST(CAST(1 AS BOOLEAN) AS JSON) as DOUBLE)" + qt_sql20 "SELECT CAST(CAST(CAST(0 AS BOOLEAN) AS JSON) as DOUBLE)" + qt_sql21 "SELECT CAST(CAST(CAST(1 AS BOOLEAN) AS JSON) as BOOLEAN)" + + qt_sql22 "SELECT CAST(CAST(CAST(1024 AS INT) AS JSON) as DOUBLE)" + qt_sql23 "SELECT CAST(CAST(CAST(1024 AS INT) AS JSON) as FLOAT)" + qt_sql24 "SELECT CAST(CAST(CAST(1024.0 AS DOUBLE) AS JSON) as DOUBLE)" + + qt_sql24 "SELECT CAST(CAST(CAST('[1, 2, 3]' AS TEXT) AS JSON) as TEXT)" + qt_sql25 "SELECT CAST(CAST(CAST('[1, 2, 3]' AS TEXT) AS JSON) as TEXT)" + qt_sql26 """SELECT CAST(CAST(CAST('["2020-01-01"]' AS TEXT) AS JSON) as TEXT)""" } \ No newline at end of file