You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-05 16:15:50 +03:00
json_depth
This commit is contained in:
@@ -65,12 +65,17 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
|
||||
if (paths.size() == 0)
|
||||
hasFound.assign(argSize, false);
|
||||
|
||||
vector<vector<json_path_step_t>> p_steps_arr(paths.size(), vector<json_path_step_t>(32));
|
||||
|
||||
for (size_t i = 2; i < fp.size(); i++)
|
||||
{
|
||||
JSONPath& path = paths[i - 2];
|
||||
|
||||
if (!path.parsed)
|
||||
{
|
||||
mem_root_dynamic_array_init(NULL, PSI_INSTRUMENT_MEM | MY_INIT_BUFFER_USED | MY_BUFFER_NO_RESIZE,
|
||||
&path.p.steps, sizeof(json_path_step_t), &p_steps_arr[i-4],
|
||||
JSON_DEPTH_LIMIT, 0, MYF(0));
|
||||
if (parseJSPath(path, row, fp[i]))
|
||||
{
|
||||
isNull = true;
|
||||
@@ -83,7 +88,17 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
|
||||
}
|
||||
|
||||
json_engine_t jsEg;
|
||||
int jsEg_stack[JSON_DEPTH_LIMIT];
|
||||
json_path_t p;
|
||||
json_path_step_t p_steps[JSON_DEPTH_LIMIT];
|
||||
|
||||
mem_root_dynamic_array_init(NULL, PSI_INSTRUMENT_MEM | MY_INIT_BUFFER_USED | MY_BUFFER_NO_RESIZE,
|
||||
&p.steps, sizeof(json_path_step_t), &p_steps,
|
||||
JSON_DEPTH_LIMIT, 0, MYF(0));
|
||||
mem_root_dynamic_array_init(NULL, PSI_INSTRUMENT_MEM | MY_INIT_BUFFER_USED | MY_BUFFER_NO_RESIZE,
|
||||
&jsEg.stack, sizeof(int), &jsEg_stack,
|
||||
JSON_DEPTH_LIMIT, 0, MYF(0));
|
||||
|
||||
json_get_path_start(&jsEg, getCharset(fp[0]), (const uchar*)js.data(), (const uchar*)js.data() + js.size(),
|
||||
&p);
|
||||
|
||||
@@ -99,8 +114,11 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
|
||||
while (json_get_path_next(&jsEg, &p) == 0)
|
||||
{
|
||||
#ifdef MYSQL_GE_1009
|
||||
json_path_step_t *last_step= (json_path_step_t*)
|
||||
(mem_root_dynamic_array_get_val(&p.steps,
|
||||
p.last_step_idx));
|
||||
if (hasNegPath && jsEg.value_type == JSON_VALUE_ARRAY &&
|
||||
json_skip_array_and_count(&jsEg, arrayCounters + (p.last_step - p.steps)))
|
||||
json_skip_array_and_count(&jsEg, arrayCounters + (last_step - (json_path_step_t*)p.steps.buffer)))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user