This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new b0c8cb0818d branch-2.1: [Bug](function) fix Could not find function
explode_json_array_json_outer #50164 (#50227)
b0c8cb0818d is described below
commit b0c8cb0818d1f59e907af03e1ebf7f4cd788fc12
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Apr 23 15:59:08 2025 +0800
branch-2.1: [Bug](function) fix Could not find function
explode_json_array_json_outer #50164 (#50227)
Cherry-picked from #50164
Co-authored-by: zhangstar333 <[email protected]>
---
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 758ec9d0ebf..c72f4e47474 100644
--- a/be/src/vec/functions/function_fake.cpp
+++ b/be/src/vec/functions/function_fake.cpp
@@ -49,9 +49,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: [email protected]
For additional commands, e-mail: [email protected]