1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-785 Implement DISTRIBUTED JSON functions

The following functions are created:
Create function JSON_VALID and test cases
Create function JSON_DEPTH and test cases
Create function JSON_LENGTH and test cases
Create function JSON_EQUALS and test cases
Create function JSON_NORMALIZE and test cases
Create function JSON_TYPE and test cases
Create function JSON_OBJECT and test cases
Create function JSON_ARRAY and test cases
Create function JSON_KEYS and test cases
Create function JSON_EXISTS and test cases
Create function JSON_QUOTE/JSON_UNQUOTE and test cases
Create function JSON_COMPACT/DETAILED/LOOSE and test cases
Create function JSON_MERGE and test cases
Create function JSON_MERGE_PATCH and test cases
Create function JSON_VALUE and test cases
Create function JSON_QUERY and test cases
Create function JSON_CONTAINS and test cases
Create function JSON_ARRAY_APPEND and test cases
Create function JSON_ARRAY_INSERT and test cases
Create function JSON_INSERT/REPLACE/SET and test cases
Create function JSON_REMOVE and test cases
Create function JSON_CONTAINS_PATH and test cases
Create function JSON_OVERLAPS and test cases
Create function JSON_EXTRACT and test cases
Create function JSON_SEARCH and test cases

Note:
Some functions output differs from MDB because session variables that affects functions output,e.g JSON_QUOTE/JSON_UNQUOTE
This depends on MCOL-5212
This commit is contained in:
Ziy1-Tan
2022-06-23 10:49:29 +08:00
parent b5d8e0324b
commit cdd41f05f3
82 changed files with 8645 additions and 2 deletions

View File

@ -29,6 +29,7 @@ using namespace std;
#include <boost/algorithm/string.hpp>
using namespace boost;
#include "functor_json.h"
#include "bytestream.h"
#include "functioncolumn.h"
#include "constantcolumn.h"
@ -323,6 +324,46 @@ void FunctionColumn::unserialize(messageqcpp::ByteStream& b)
Func_decode* decode = dynamic_cast<Func_decode*>(fFunctor);
if (decode)
fFunctor = fDynamicFunctor = new Func_decode();
// Special treatment for json function contains the variable path. reset the variable path
if (dynamic_cast<Func_json_length*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_length();
if (dynamic_cast<Func_json_keys*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_keys();
if (dynamic_cast<Func_json_exists*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_exists();
if (dynamic_cast<Func_json_value*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_value();
if (dynamic_cast<Func_json_query*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_query();
if (dynamic_cast<Func_json_contains*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_contains();
if (dynamic_cast<Func_json_array_append*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_array_append();
if (dynamic_cast<Func_json_array_insert*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_array_insert();
if (auto f = dynamic_cast<Func_json_insert*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_insert(f->getMode());
if (dynamic_cast<Func_json_remove*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_remove();
if (dynamic_cast<Func_json_contains_path*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_contains_path();
if (dynamic_cast<Func_json_search*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_search();
if (dynamic_cast<Func_json_extract*>(fFunctor))
fFunctor = fDynamicFunctor = new Func_json_extract();
}
bool FunctionColumn::operator==(const FunctionColumn& t) const