Skip to content

Commit

Permalink
fix case
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed Jun 25, 2024
1 parent a92c050 commit 265f8e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion be/src/vec/functions/function_jsonb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class FunctionJsonbKeys : public IFunction {
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
DCHECK_GE(arguments.size(), 1);
if (arguments.size() != 1 || arguments.size() != 2) {
if (arguments.size() != 1 && arguments.size() != 2) {
// here has argument param error
return Status::InvalidArgument("json_keys should have 1 or 2 arguments");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7564,8 +7564,8 @@ false
31 18446744073709551615 \N

-- !select_json_keys --
{"a.b.c":{"k1.a1":"v31","k2":300},"a":{}} $.a []
{"a.b.c":{"k1.a1":"v31","k2":300}} $.a.b.c \N
{"a.b.c":{"k1.a1":"v31","k2":300},"a":{"k1.a1":1}} $.a ["k1.a1"]
["a","b"] $.a \N
1 {"a.b.c":{"k1.a1":"v31","k2":300},"a":{}} $.a []
2 {"a.b.c":{"k1.a1":"v31","k2":300}} $.a.b.c \N
3 {"a.b.c":{"k1.a1":"v31","k2":300},"a":{"k1.a1":1}} $.a ["k1.a1"]
4 ["a","b"] $.a \N

Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ suite("test_jsonb_load_and_function", "p0") {
qt_select_json_keys """SELECT id, j, json_keys(j, '\$.k2') FROM ${testTable} ORDER BY id"""
qt_select_json_keys """SELECT id, j, json_keys(j, '\$.a1') FROM ${testTable} ORDER BY id"""

// make table with path
// make table with path
sql """ DROP TABLE IF EXISTS json_keys_table;"""
sql """
CREATE TABLE IF NOT EXISTS json_keys_table (
id INT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,9 @@ suite("nereids_scalar_fn_J") {
qt_select_json_keys """SELECT id, j, json_keys(j, '\$.a1') FROM ${testTable} ORDER BY id"""

// make table with path
sql """ DROP TABLE IF EXISTS json_keys_table_nereid; """
sql """
CREATE TABLE IF NOT EXISTS json_keys_table (
CREATE TABLE IF NOT EXISTS json_keys_table_nereid (
id INT,
j JSONB,
p STRING
Expand All @@ -576,8 +577,8 @@ suite("nereids_scalar_fn_J") {
PROPERTIES("replication_num" = "1");
"""

sql """ insert into json_keys_table values (1, '{"a.b.c":{"k1.a1":"v31", "k2": 300}, "a": {}}', '\$.a'), (2, '{"a.b.c":{"k1.a1":"v31", "k2": 300}}', '\$.a.b.c'), (3, '{"a.b.c":{"k1.a1":"v31", "k2": 300}, "a": {"k1.a1": 1}}', '\$.a'), (4, '["a", "b"]', '\$.a'); """
qt_select_json_keys """SELECT j, p, json_keys(j, p) FROM json_keys_table ORDER BY id"""
sql """ insert into json_keys_table_nereid values (1, '{"a.b.c":{"k1.a1":"v31", "k2": 300}, "a": {}}', '\$.a'), (2, '{"a.b.c":{"k1.a1":"v31", "k2": 300}}', '\$.a.b.c'), (3, '{"a.b.c":{"k1.a1":"v31", "k2": 300}, "a": {"k1.a1": 1}}', '\$.a'), (4, '["a", "b"]', '\$.a'); """
qt_select_json_keys """SELECT id, j, p, json_keys(j, p) FROM json_keys_table_nereid ORDER BY id"""


}

0 comments on commit 265f8e0

Please sign in to comment.