This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 02137be4a5b [fix](function) Fixed a crash in json_set caused by a JSON
path referencing a non-existent element (#54981)
02137be4a5b is described below
commit 02137be4a5b8de71a85bd18848031fb39caf6b2c
Author: Jerry Hu <[email protected]>
AuthorDate: Mon Aug 25 14:04:08 2025 +0800
[fix](function) Fixed a crash in json_set caused by a JSON path referencing
a non-existent element (#54981)
---
be/src/vec/functions/function_jsonb.cpp | 1 -
.../json_function/test_query_json_insert.out | Bin 2095 -> 2121 bytes
.../json_function/test_query_json_replace.out | Bin 1671 -> 1698 bytes
.../json_function/test_query_json_set.out | Bin 1500 -> 1841 bytes
.../json_function/test_query_json_insert.groovy | 2 ++
.../json_function/test_query_json_replace.groovy | 1 +
.../json_function/test_query_json_set.groovy | 8 ++++++++
7 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/functions/function_jsonb.cpp
b/be/src/vec/functions/function_jsonb.cpp
index 9cf80f7d46f..1835c4e5b58 100644
--- a/be/src/vec/functions/function_jsonb.cpp
+++ b/be/src/vec/functions/function_jsonb.cpp
@@ -2065,7 +2065,6 @@ public:
if
(!build_parents_by_path(json_documents[row_idx]->getValue(), new_path,
parents)) {
- DCHECK(false);
continue;
}
}
diff --git
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_insert.out
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_insert.out
index a63a47f4e50..03210f0f6a2 100644
Binary files
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_insert.out
and
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_insert.out
differ
diff --git
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_replace.out
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_replace.out
index 140e3c8a22e..ac8cfb45010 100644
Binary files
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_replace.out
and
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_replace.out
differ
diff --git
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_set.out
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_set.out
index c788831aca3..b57a50e314b 100644
Binary files
a/regression-test/data/query_p0/sql_functions/json_function/test_query_json_set.out
and
b/regression-test/data/query_p0/sql_functions/json_function/test_query_json_set.out
differ
diff --git
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_insert.groovy
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_insert.groovy
index cac7ef4b7a4..95c0cc3ab64 100644
---
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_insert.groovy
+++
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_insert.groovy
@@ -115,6 +115,8 @@ suite("test_query_json_insert", "query,arrow_flight_sql") {
qt_insert4 """select json_insert('{"k": 1}', '\$.k[1]', 2);"""
qt_insert5 """select json_insert('{"k": 1}', '\$.k[1]', NULL);"""
qt_insert6 """select json_insert('{"k": 1}', NULL, 2);"""
+ qt_insert7 """select json_insert('{"a": 200}', '\$.a', 100, '\$.b.a',
200);"""
+
test {
sql "select json_insert('1', '\$.*', 4);"
diff --git
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_replace.groovy
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_replace.groovy
index aed54212728..69f7142eff7 100644
---
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_replace.groovy
+++
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_replace.groovy
@@ -122,6 +122,7 @@ suite("test_query_json_replace", "query") {
qt_replace4 """select json_replace('{"k": 1}', '\$.k[1]', 2);"""
qt_replace5 """select json_replace('{"k": 1}', '\$.k[0]', NULL);"""
qt_replace6 """select json_replace('{"k": 1}', NULL, 2);"""
+ qt_replace8 """select json_replace('{"a": 200}', '\$.a', 100, '\$.b.a',
200);"""
test {
sql """select json_replace('1', '\$.*', 4);"""
diff --git
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_set.groovy
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_set.groovy
index 75a8f0417fd..705e6046705 100644
---
a/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_set.groovy
+++
b/regression-test/suites/query_p0/sql_functions/json_function/test_query_json_set.groovy
@@ -93,6 +93,13 @@ suite("test_query_json_set", "query") {
'\$.data.array', k1,
'\$.data.struct', k3,
'\$.data.json', k4) from ${tableName} order by
k0;"""
+ qt_sql3 """
+ select json_set(
+ '{"data": {"array": null, "map": null, "struct": null, "json":
null}}',
+ '\$.data1.array', k1,
+ '\$.data2.struct', k3
+ ) from ${tableName} order by k0;
+ """
sql "DROP TABLE ${tableName};"
qt_set1 """select json_set('1', '\$[0]', 2);"""
@@ -102,6 +109,7 @@ suite("test_query_json_set", "query") {
qt_set5 """select json_set('{"k": 1}', '\$.k[0]', NULL);"""
qt_set6 """select json_set('{"k": 1}', '\$.k[1]', NULL);"""
qt_set7 """select json_set('{"k": 1}', NULL, 2);"""
+ qt_set8 """select json_set('{}', '\$.a', 100, '\$.b.a', 200);"""
test {
sql """select json_set('1', '\$.*', 4);"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]