1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

chore(build) : fix debug build with MYSQL_VERSION_ID >= 10090

This commit is contained in:
Leonid Fedorov
2025-05-30 12:34:17 +00:00
committed by Leonid Fedorov
parent aa7e0fb9b4
commit bb833ac9f6
8 changed files with 23 additions and 30 deletions

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
@ -76,7 +76,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
}
@ -98,7 +98,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
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, arrayCounters + (p.last_step - p.steps)))
{
@ -110,7 +110,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

@ -29,7 +29,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
@ -45,12 +45,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);
@ -70,13 +70,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
#if MYSQL_VERSION_ID >= 100900
if (hasNegPath && jsEg.value_type == JSON_VALUE_ARRAY &&
json_skip_array_and_count(&jsEg, arrayCounter + (p.last_step - p.steps)))
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

@ -136,7 +136,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
json_path_t p, savPath;
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
@ -151,7 +151,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
{
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
}
@ -161,7 +161,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 + (p.last_step - p.steps)))
goto error;
@ -169,7 +169,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;