mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-23 07:05:36 +03:00
This patch improves handling of NULLs in textual fields in ColumnStore. Previously empty strings were considered NULLs and it could be a problem if data scheme allows for empty strings. It was also one of major reasons of behavior difference between ColumnStore and other engines in MariaDB family. Also, this patch fixes some other bugs and incorrect behavior, for example, incorrect comparison for "column <= ''" which evaluates to constant True for all purposes before this patch.
35 lines
903 B
C++
35 lines
903 B
C++
#include <string_view>
|
|
using namespace std;
|
|
|
|
#include "functor_json.h"
|
|
#include "functioncolumn.h"
|
|
#include "rowgroup.h"
|
|
using namespace execplan;
|
|
using namespace rowgroup;
|
|
|
|
#include "dataconvert.h"
|
|
|
|
#include "jsonhelpers.h"
|
|
using namespace funcexp::helpers;
|
|
namespace funcexp
|
|
{
|
|
CalpontSystemCatalog::ColType Func_json_valid::operationType(FunctionParm& fp,
|
|
CalpontSystemCatalog::ColType& resultType)
|
|
{
|
|
return fp[0]->data()->resultType();
|
|
}
|
|
|
|
/**
|
|
* getBoolVal API definition
|
|
*/
|
|
bool Func_json_valid::getBoolVal(Row& row, FunctionParm& fp, bool& isNull,
|
|
CalpontSystemCatalog::ColType& type)
|
|
{
|
|
const auto js = fp[0]->data()->getStrVal(row, isNull);
|
|
if (isNull)
|
|
return false;
|
|
|
|
return json_valid(js.unsafeStringRef().data(), js.unsafeStringRef().size(), getCharset(fp[0]));
|
|
}
|
|
} // namespace funcexp
|