1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

Merge branch 'stable-23.10' into json_depth-rucha

This commit is contained in:
Rucha Deodhar
2025-06-03 16:29:29 +05:30
committed by GitHub
200 changed files with 2722 additions and 20812 deletions

View File

@@ -143,13 +143,13 @@ set(funcexp_LIB_SRCS
)
columnstore_library(funcexp ${funcexp_LIB_SRCS})
add_dependencies(funcexp loggingcpp)
target_link_libraries(funcexp ${NETSNMP_LIBRARIES} pron pcre2-8 ${MARIADB_STRING_LIBS})
install(
TARGETS funcexp
DESTINATION ${ENGINE_LIBDIR}
COMPONENT columnstore-engine
columnstore_link(
funcexp
PRIVATE
pcre2-8
pron
loggingcpp
dataconvert
${MARIADB_STRING_LIBS}
${NETSNMP_LIBRARIES}
)

View File

@@ -34,7 +34,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
const string_view js = js_ns.unsafeStringRef();
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int arrayCounters[JSON_DEPTH_LIMIT];
bool hasNegPath = false;
#endif
@@ -81,7 +81,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
isNull = true;
return false;
}
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
hasNegPath |= path.p.types_used & JSON_PATH_NEGATIVE_INDEX;
#endif
}
@@ -113,7 +113,6 @@ 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));
@@ -128,7 +127,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
for (int restSize = argSize, curr = 0; restSize > 0; restSize--, curr++)
{
JSONPath& path = paths[curr];
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int cmp = cmpJSPath(&path.p, &p, jsEg.value_type, arrayCounters);
#else
int cmp = cmpJSPath(&path.p, &p, jsEg.value_type);

View File

@@ -31,7 +31,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t
bool mayMulVal;
int wildcards;
bool isMatch;
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int arrayCounter[JSON_DEPTH_LIMIT];
bool hasNegPath = false;
#endif
@@ -62,12 +62,12 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t
if (!path.parsed && parseJSPath(path, row, fp[i]))
return 1;
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
hasNegPath |= path.p.types_used & JSON_PATH_NEGATIVE_INDEX;
#endif
}
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
wildcards = (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD | JSON_PATH_ARRAY_RANGE);
#else
wildcards = (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD);
@@ -87,14 +87,13 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t
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, arrayCounter + (last_step - (json_path_step_t*)(p.steps.buffer))))
return 1;
#endif
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
isMatch = matchJSPath(paths, &p, jsEg.value_type, arrayCounter, false);
#else
isMatch = matchJSPath(paths, &p, jsEg.value_type, nullptr, false);

View File

@@ -141,7 +141,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
json_path_step_t savPath_steps[JSON_DEPTH_LIMIT], p_steps[JSON_DEPTH_LIMIT];
const CHARSET_INFO* cs = getCharset(fp[0]);
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int arrayCounter[JSON_DEPTH_LIMIT];
bool hasNegPath = 0;
#endif
@@ -167,7 +167,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
JSON_DEPTH_LIMIT, 0, MYF(0));
if (parseJSPath(path, row, fp[i]))
goto error;
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
hasNegPath |= path.p.types_used & JSON_PATH_NEGATIVE_INDEX;
#endif
}
@@ -181,7 +181,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
while (json_get_path_next(&jsEg, &p) == 0)
{
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
if (hasNegPath && jsEg.value_type == JSON_VALUE_ARRAY &&
json_skip_array_and_count(&jsEg, arrayCounter + (((json_path_step_t*)(mem_root_dynamic_array_get_val(&p.steps, p.last_step_idx))) - (json_path_step_t*)p.steps.buffer)))
goto error;
@@ -189,7 +189,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
if (json_value_scalar(&jsEg))
{
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
bool isMatch = matchJSPath(paths, &p, jsEg.value_type, arrayCounter);
#else
bool isMatch = matchJSPath(paths, &p, jsEg.value_type);

View File

@@ -163,7 +163,7 @@ FuncExp::FuncExp()
fFuncMap["json_merge_preserve"] = new Func_json_merge();
fFuncMap["json_normalize"] = new Func_json_normalize();
fFuncMap["json_object"] = new Func_json_object();
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
fFuncMap["json_overlaps"] = new Func_json_overlaps();
#endif
fFuncMap["json_query"] = new Func_json_query();
@@ -218,7 +218,7 @@ FuncExp::FuncExp()
fFuncMap["regexp"] = new Func_regexp();
fFuncMap["regexp_instr"] = new Func_regexp_instr();
fFuncMap["regexp_replace"] = new Func_regexp_replace();
fFuncMap["regexp_substr"] = new Func_regexp_substr(); // dlh
fFuncMap["regexp_substr"] = new Func_regexp_substr(); // dlh
fFuncMap["repeat"] = new Func_repeat(); // dlh
fFuncMap["replace"] = new Func_replace(); // dlh
fFuncMap["replace_oracle"] = new Func_replace_oracle(); // dlh

View File

@@ -12,13 +12,6 @@
#include "functor_int.h"
#include "functor_str.h"
// Check if mariadb version >= 10.9
#if MYSQL_VERSION_ID >= 100900
#ifndef MYSQL_GE_1009
#define MYSQL_GE_1009
#endif
#endif
namespace funcexp
{
// The json_path_t wrapper include some flags

View File

@@ -13,7 +13,7 @@ int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const utils::NullString& st
if (!err)
{
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
bool support = (path->types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD | JSON_PATH_ARRAY_RANGE)) == 0;
#else
bool support = (path->types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD)) == 0;
@@ -252,7 +252,7 @@ int cmpPartJSPath(const json_path_step_t* a, const json_path_step_t* aEnd, const
{
if (b->type & JSON_PATH_ARRAY)
{
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int ret = 0, corrected_n_item_a = 0;
if (arraySize)
corrected_n_item_a = a->n_item < 0 ? arraySize[b - tmpB] + a->n_item : a->n_item;
@@ -360,7 +360,7 @@ bool matchJSPath(const vector<funcexp::JSONPath>& paths, const json_path_t* p, j
{
for (size_t curr = 0; curr < paths.size(); curr++)
{
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
int cmp = cmpJSPath(&paths[curr].p, p, valType, arrayCounter);
#else
int cmp = cmpJSPath(&paths[curr].p, p, valType);

View File

@@ -49,7 +49,7 @@ static const int TRIVIAL_PATH_NOT_ALLOWED = 3;
bool findKeyInObject(json_engine_t* jsEg, json_string_t* key);
#ifdef MYSQL_GE_1009
#if MYSQL_VERSION_ID >= 100900
using IntType = int;
#else
using IntType = uint;