[bug](jsonb) fix jsonb query bug When the json key value contains "." (#19185)

Issue Number: close #19173

mysql> SELECT jsonb_extract('{"a.b.c":{"k1":"v31", "k2.a1": 300},"a":"opentelemetry"}', '$."a.b.c".k1');
+-------------------------------------------------------------------------------------------+
| jsonb_extract('{"a.b.c":{"k1":"v31", "k2.a1": 300},"a":"opentelemetry"}', '$."a.b.c".k1') |
+-------------------------------------------------------------------------------------------+
| "v31" |
+-------------------------------------------------------------------------------------------+
1 row in set (0.06 sec)
This commit is contained in:
Liqf
2023-05-15 15:43:12 +08:00
committed by GitHub
parent 052c7cff89
commit c87e78dc35
8 changed files with 966 additions and 90 deletions

View File

@ -421,7 +421,7 @@ private:
}
// value is NOT necessary to be deleted since JsonbValue will not allocate memory
JsonbValue* value = doc->getValue()->findPath(r_raw, r_size, ".", nullptr);
JsonbValue* value = doc->getValue()->findPath(r_raw, r_size, nullptr);
if (UNLIKELY(!value)) {
StringOP::push_null_string(i, res_data, res_offsets, null_map);
return;
@ -572,7 +572,7 @@ private:
}
// value is NOT necessary to be deleted since JsonbValue will not allocate memory
JsonbValue* value = doc->getValue()->findPath(r_raw_str, r_str_size, ".", nullptr);
JsonbValue* value = doc->getValue()->findPath(r_raw_str, r_str_size, nullptr);
if (UNLIKELY(!value)) {
if constexpr (!only_check_exists) {