This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 1659df517e1 branch-3.0: [Bug](function) fix Could not find function explode_json_array_json_outer #50164 (#50226) 1659df517e1 is described below commit 1659df517e1cfa5e8894d8e6e910c4531aa500e0 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Fri Apr 25 19:45:49 2025 +0800 branch-3.0: [Bug](function) fix Could not find function explode_json_array_json_outer #50164 (#50226) Cherry-picked from #50164 Co-authored-by: zhangstar333 <zhangs...@selectdb.com> --- be/src/vec/functions/function_fake.cpp | 3 --- .../generator/ExplodeJsonArrayJsonOuter.java | 4 +-- .../table_function/explode_json_array.out | Bin 6692 -> 6751 bytes .../table_function/explode_json_array.groovy | 29 ++++++++++++++++++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/be/src/vec/functions/function_fake.cpp b/be/src/vec/functions/function_fake.cpp index 646da600b50..8ba400e7944 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<ReturnType>())}; - } return {std::make_shared<ReturnType>()}; } 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 ab358855196..f1823ea20a7 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 @@ package org.apache.doris.nereids.trees.expressions.functions.generator; 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 @@ import java.util.List; * 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<FunctionSignature> 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 f75b56b3305..97ee71f47a4 100644 Binary files a/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out and b/regression-test/data/query_p0/sql_functions/table_function/explode_json_array.out differ 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 edc1bc7fa1a..368b58e1367 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; + """ + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org