You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-1559 remove the #define POSIX_REGEX and thus the use of regexec. Fix up the code changing #ifdef _MSC_VER to #ifdef POSIX_REGEX, where it applies to regexec.
This commit is contained in:
@ -205,11 +205,11 @@ ConstantColumn::ConstantColumn( const ConstantColumn& rhs):
|
|||||||
if (fRegex.get() != NULL)
|
if (fRegex.get() != NULL)
|
||||||
{
|
{
|
||||||
fRegex.reset(new CNX_Regex());
|
fRegex.reset(new CNX_Regex());
|
||||||
#ifdef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
*fRegex = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
|
||||||
#else
|
|
||||||
string str = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
string str = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
||||||
regcomp(fRegex.get(), str.c_str(), REG_NOSUB | REG_EXTENDED);
|
regcomp(fRegex.get(), str.c_str(), REG_NOSUB | REG_EXTENDED);
|
||||||
|
#else
|
||||||
|
*fRegex = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ ConstantColumn::ConstantColumn(const uint64_t val, TYPE type) :
|
|||||||
|
|
||||||
ConstantColumn::~ConstantColumn()
|
ConstantColumn::~ConstantColumn()
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
|
|
||||||
if (fRegex.get() != NULL)
|
if (fRegex.get() != NULL)
|
||||||
regfree(fRegex.get());
|
regfree(fRegex.get());
|
||||||
@ -394,11 +394,11 @@ void ConstantColumn::constructRegex()
|
|||||||
{
|
{
|
||||||
//fRegex = new regex_t();
|
//fRegex = new regex_t();
|
||||||
fRegex.reset(new CNX_Regex());
|
fRegex.reset(new CNX_Regex());
|
||||||
#ifdef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
*fRegex = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
|
||||||
#else
|
|
||||||
string str = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
string str = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
||||||
regcomp(fRegex.get(), str.c_str(), REG_NOSUB | REG_EXTENDED);
|
regcomp(fRegex.get(), str.c_str(), REG_NOSUB | REG_EXTENDED);
|
||||||
|
#else
|
||||||
|
*fRegex = dataconvert::DataConvert::constructRegexp(fResult.strVal);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,31 +128,31 @@ inline bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, Retu
|
|||||||
// considers these nulls significant, but they're not in the pattern, so we need to strip
|
// considers these nulls significant, but they're not in the pattern, so we need to strip
|
||||||
// them off...
|
// them off...
|
||||||
const std::string& v = lop->getStrVal(row, isNull);
|
const std::string& v = lop->getStrVal(row, isNull);
|
||||||
char* c = (char*)alloca(v.length() + 1);
|
// char* c = (char*)alloca(v.length() + 1);
|
||||||
memcpy(c, v.c_str(), v.length());
|
// memcpy(c, v.c_str(), v.length());
|
||||||
c[v.length()] = 0;
|
// c[v.length()] = 0;
|
||||||
std::string vv(c);
|
// std::string vv(c);
|
||||||
|
|
||||||
if (regex)
|
if (regex)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
bool ret = boost::regex_match(vv, *regex);
|
bool ret = regexec(regex.get(), v.c_str(), 0, NULL, 0) == 0;
|
||||||
#else
|
#else
|
||||||
bool ret = regexec(regex.get(), vv.c_str(), 0, NULL, 0) == 0;
|
bool ret = boost::regex_match(v.c_str(), *regex);
|
||||||
#endif
|
#endif
|
||||||
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
boost::regex regex(dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull)));
|
|
||||||
bool ret = boost::regex_match(vv, regex);
|
|
||||||
#else
|
|
||||||
regex_t regex;
|
regex_t regex;
|
||||||
std::string str = dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull));
|
std::string str = dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull));
|
||||||
regcomp(®ex, str.c_str(), REG_NOSUB | REG_EXTENDED);
|
regcomp(®ex, str.c_str(), REG_NOSUB | REG_EXTENDED);
|
||||||
bool ret = regexec(®ex, vv.c_str(), 0, NULL, 0) == 0;
|
bool ret = regexec(®ex, v.c_str(), 0, NULL, 0) == 0;
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
|
#else
|
||||||
|
boost::regex regex(dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull)));
|
||||||
|
bool ret = boost::regex_match(v.c_str(), regex);
|
||||||
#endif
|
#endif
|
||||||
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
||||||
}
|
}
|
||||||
|
@ -167,10 +167,10 @@ typedef IDB_Decimal CNX_Decimal;
|
|||||||
* @brief IDB_Regex struct
|
* @brief IDB_Regex struct
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
#ifdef POSIX_REGEX
|
||||||
typedef boost::regex IDB_Regex;
|
|
||||||
#else
|
|
||||||
typedef regex_t IDB_Regex;
|
typedef regex_t IDB_Regex;
|
||||||
|
#else
|
||||||
|
typedef boost::regex IDB_Regex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef IDB_Regex CNX_Regex;
|
typedef IDB_Regex CNX_Regex;
|
||||||
|
@ -1644,15 +1644,13 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo)
|
|||||||
// type of pseudo column is set by connector
|
// type of pseudo column is set by connector
|
||||||
if (!sc->schemaName().empty() && sc->isInfiniDB() && !pc)
|
if (!sc->schemaName().empty() && sc->isInfiniDB() && !pc)
|
||||||
ct = jobInfo.csc->colType(sc->oid());
|
ct = jobInfo.csc->colType(sc->oid());
|
||||||
|
//X
|
||||||
|
|
||||||
// Because, on a filter, we want to compare ignoring trailing spaces in many cases
|
// Because, on a filter, we want to compare ignoring trailing spaces in many cases
|
||||||
// MaraiDB Server compares without trim for LIKE against CHAR.
|
if (sf->op()->op() != execplan::OP_LIKE)
|
||||||
if (ct.colDataType != execplan::CalpontSystemCatalog::CHAR ||
|
|
||||||
sf->op()->op() != execplan::OP_LIKE)
|
|
||||||
{
|
{
|
||||||
boost::algorithm::trim_right_if(constval, boost::is_any_of(" "));
|
boost::algorithm::trim_right_if(constval, boost::is_any_of(" "));
|
||||||
}
|
}
|
||||||
//X
|
|
||||||
//@bug 339 nulls are not stored in dictionary
|
//@bug 339 nulls are not stored in dictionary
|
||||||
if ((dictOid = isDictCol(ct)) > 0 && ConstantColumn::NULLDATA != cc->type())
|
if ((dictOid = isDictCol(ct)) > 0 && ConstantColumn::NULLDATA != cc->type())
|
||||||
{
|
{
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
//#ifdef __linux__
|
||||||
#define POSIX_REGEX
|
//#define POSIX_REGEX
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
#ifdef POSIX_REGEX
|
#ifdef POSIX_REGEX
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
@ -166,7 +166,6 @@ int idb_strtrimcoll(const std::string& str1, const std::string& str2)
|
|||||||
std::locale loc;
|
std::locale loc;
|
||||||
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
|
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
|
||||||
int rtn = coll.compare(s1, s1+found1+1, s2, s2+found2+1);
|
int rtn = coll.compare(s1, s1+found1+1, s2, s2+found2+1);
|
||||||
// return coll.compare(s1, s1+found1, s2, s2+found2);
|
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user