diff --git a/be/src/vec/functions/function_fake.cpp b/be/src/vec/functions/function_fake.cpp index 5ae8d836384c0e..70828fa4a6867e 100644 --- a/be/src/vec/functions/function_fake.cpp +++ b/be/src/vec/functions/function_fake.cpp @@ -50,9 +50,6 @@ struct FunctionFakeBaseImpl { } static DataTypes get_variadic_argument_types() { if constexpr (VARIADIC) { - if constexpr (AlwaysNullable) { - return {make_nullable(std::make_shared())}; - } return {std::make_shared()}; } else { return {}; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/generator/ExplodeJsonArrayJsonOuter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/generator/ExplodeJsonArrayJsonOuter.java index ab358855196db5..f1823ea20a7a79 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/generator/ExplodeJsonArrayJsonOuter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/generator/ExplodeJsonArrayJsonOuter.java @@ -19,7 +19,7 @@ import org.apache.doris.catalog.FunctionSignature; import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable; +import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable; import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; import org.apache.doris.nereids.types.JsonType; @@ -34,7 +34,7 @@ * explode_json_array_json_outer("[{"id":1,"name":"John"},{"id":2,"name":"Mary"},{"id":3,"name":"Bob"}]"), * generate 3 lines include '{"id":1,"name":"John"}', '{"id":2,"name":"Mary"}' and '{"id":3,"name":"Bob"}'. */ -public class ExplodeJsonArrayJsonOuter extends TableGeneratingFunction implements UnaryExpression, PropagateNullable { +public class ExplodeJsonArrayJsonOuter extends TableGeneratingFunction implements UnaryExpression, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(JsonType.INSTANCE).args(JsonType.INSTANCE), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(VarcharType.SYSTEM_DEFAULT) diff --git a/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out b/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out index f75b56b3305cde..97ee71f47a4ef9 100644 --- a/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out +++ b/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out @@ -227,3 +227,8 @@ 400 Dan 50 4 Street 4 22.214 b 400 Dan 50 4 Street 4 214.1 b +-- !explode_json_array17 -- +4 {"a":1} +4 {"b":2} +4 {"c":3} + diff --git a/regression-test/suites/query_p0/sql_functions/table_function/explode_json_array.groovy b/regression-test/suites/query_p0/sql_functions/table_function/explode_json_array.groovy index edc1bc7fa1a3f7..368b58e1367cde 100644 --- a/regression-test/suites/query_p0/sql_functions/table_function/explode_json_array.groovy +++ b/regression-test/suites/query_p0/sql_functions/table_function/explode_json_array.groovy @@ -89,5 +89,32 @@ suite("explode_json_array") { qt_explode_json_array16 """ SELECT id, name, age, class, address, d, c FROM person LATERAL VIEW EXPLODE_JSON_ARRAY_STRING('[null, "b", null]') t1 as c LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE('[1.23, 22.214, 214.1]') t2 as d - ORDER BY id, c, d """ + ORDER BY id, c, d """ + sql """ DROP TABLE IF EXISTS json_array_example """ + sql """ + CREATE TABLE json_array_example ( + id INT, + json_array STRING + )DUPLICATE KEY(id) + DISTRIBUTED BY HASH(id) BUCKETS AUTO + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1"); + """ + sql """ + INSERT INTO json_array_example (id, json_array) VALUES + (1, '[1, 2, 3, 4, 5]'), + (2, '[1.1, 2.2, 3.3, 4.4]'), + (3, '["apple", "banana", "cherry"]'), + (4, '[{"a": 1}, {"b": 2}, {"c": 3}]'), + (5, '[]'), + (6, 'NULL'); + """ + + qt_explode_json_array17 """ + SELECT id, e1 + FROM json_array_example + LATERAL VIEW EXPLODE_JSON_ARRAY_JSON_OUTER(json_array) tmp1 AS e1 + WHERE id = 4 order by id, e1; + """ + }