Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions be/src/vec/functions/function_fake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(JsonType.INSTANCE).args(JsonType.INSTANCE),
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(VarcharType.SYSTEM_DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Original file line number Diff line number Diff line change
Expand Up @@ -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;
"""

}
Loading