diff --git a/src/Functions/FunctionsJSON.h b/src/Functions/FunctionsJSON.h index 7407a3ec611..4f91440105d 100644 --- a/src/Functions/FunctionsJSON.h +++ b/src/Functions/FunctionsJSON.h @@ -1378,7 +1378,7 @@ public: auto & col_tuple = assert_cast(col_arr.getData()); auto & col_key = assert_cast(col_tuple.getColumn(0)); - for (auto [key, value] : object) + for (const auto & [key, value] : object) { col_key.insertData(key.data(), key.size()); } diff --git a/tests/queries/0_stateless/00918_json_functions.sql b/tests/queries/0_stateless/00918_json_functions.sql index bce84df08bf..87682587c8e 100644 --- a/tests/queries/0_stateless/00918_json_functions.sql +++ b/tests/queries/0_stateless/00918_json_functions.sql @@ -233,9 +233,9 @@ SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300], "c": SELECT '--JSONExtractKeys--'; SELECT JSONExtractKeys('{"a": "hello", "b": [-100, 200.0, 300]}'); -SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b'); -SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'a'); -SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300], "c":{"d":[121,144]}}', 'c'); +SELECT JSONExtractKeys('{"a": "hello", "b": [-100, 200.0, 300]}', 'b'); +SELECT JSONExtractKeys('{"a": "hello", "b": [-100, 200.0, 300]}', 'a'); +SELECT JSONExtractKeys('{"a": "hello", "b": [-100, 200.0, 300], "c":{"d":[121,144]}}', 'c'); SELECT '--const/non-const mixed--'; SELECT JSONExtractString('["a", "b", "c", "d", "e"]', idx) FROM (SELECT arrayJoin([1,2,3,4,5]) AS idx);