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

Merge branch 'develop-1.1' into 1.1-merge-up-20180817

This commit is contained in:
Andrew Hutchings
2018-08-17 16:17:13 +01:00
47 changed files with 1526 additions and 756 deletions

View File

@@ -1,4 +1,3 @@
INCLUDE_DIRECTORIES( ${ENGINE_COMMON_INCLUDES} )
ADD_CUSTOM_COMMAND(
@@ -13,7 +12,7 @@ ADD_CUSTOM_TARGET(ddl-lexer DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ddl-scan.cpp)
ADD_CUSTOM_TARGET(ddl-parser DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ddl-gram.cpp)
# Parser puts extra info to stderr.
INCLUDE(../../check_compiler_flag.cmake)
MY_CHECK_AND_SET_COMPILER_FLAG("-DYYDEBUG" DEBUG)
MY_CHECK_AND_SET_COMPILER_FLAG("-DYYDEBUG=1" DEBUG)
########### next target ###############

View File

@@ -33,6 +33,9 @@
using namespace ddlpackage;
typedef enum { NOOP, STRIP_QUOTES } copy_action_t;
#if YYDEBUG == 0
int ddldebug = 0;
#endif
int lineno = 1;
void ddlerror(struct pass_to_bison* x, char const *s);

View File

@@ -63,7 +63,6 @@ char* copy_string(const char *str);
%pure-parser
%lex-param {void * scanner}
%parse-param {struct ddlpackage::pass_to_bison * x}
%debug
/* Bison uses this to generate a C union definition. This is used to
store the application created values associated with syntactic

View File

@@ -368,11 +368,7 @@ bool ArithmeticColumn::operator==(const ArithmeticColumn& t) const
else if (fExpression != NULL || t.fExpression != NULL)
return false;
if (fAlias != t.fAlias)
return false;
if (fTableAlias != t.fTableAlias)
return false;
if (fData != t.fData)
return false;

View File

@@ -49,6 +49,15 @@ using namespace logging;
#include "clientrotator.h"
//#include "idb_mysql.h"
/** Debug macro */
#ifdef INFINIDB_DEBUG
#define IDEBUG(x) {x;}
#else
#define IDEBUG(x) {}
#endif
#define LOG_TO_CERR
namespace execplan
@@ -60,14 +69,36 @@ const uint64_t LOCAL_EXEMGR_PORT = 8601;
string ClientRotator::getModule()
{
string installDir = startup::StartUp::installDir();
//Log to debug.log
LoggingID logid( 24, 0, 0);
string fileName = installDir + "/local/module";
string module;
ifstream moduleFile (fileName.c_str());
if (moduleFile.is_open())
{
getline (moduleFile, module);
}
else
{
{
logging::Message::Args args1;
logging::Message msg(1);
std::ostringstream oss;
oss << "ClientRotator::getModule open status2 =" << strerror(errno);
args1.add(oss.str());
args1.add(fileName);
msg.format( args1 );
Logger logger(logid.fSubsysID);
logger.logMessage(LOG_TYPE_DEBUG, msg, logid);
}
}
moduleFile.close();
return module;
}

View File

@@ -328,8 +328,6 @@ bool ConstantColumn::operator==(const ConstantColumn& t) const
if (fType != t.fType)
return false;
if (fAlias != t.fAlias)
return false;
if (fData != t.fData)
return false;

View File

@@ -332,8 +332,6 @@ bool FunctionColumn::operator==(const FunctionColumn& t) const
if (**it != **it2)
return false;
// if (fAlias != t.fAlias)
// return false;
if (fTableAlias != t.fTableAlias)
return false;

View File

@@ -173,14 +173,13 @@ void ReturnedColumn::unserialize(messageqcpp::ByteStream& b)
bool ReturnedColumn::operator==(const ReturnedColumn& t) const
{
// Not all fields are considered for a positive equality.
if (fData != t.fData)
return false;
if (fCardinality != t.fCardinality)
return false;
//if (fAlias != t.fAlias)
// return false;
if (fDistinct != t.fDistinct)
return false;
@@ -193,24 +192,18 @@ bool ReturnedColumn::operator==(const ReturnedColumn& t) const
if (fNullsFirst != t.fNullsFirst)
return false;
//if (fOrderPos != t.fOrderPos)
// return false;
if (fInputIndex != t.fInputIndex)
return false;
if (fOutputIndex != t.fOutputIndex)
return false;
//if (fSequence != t.fSequence)
// return false;
if (fResultType != t.fResultType)
return false;
if (fOperationType != t.fOperationType)
return false;
//if (fExpressionId != t.fExpressionId)
// return false;
return true;
}

View File

@@ -346,7 +346,6 @@ void SimpleColumn::serialize(messageqcpp::ByteStream& b) const
b << fViewName;
b << (uint32_t) fOid;
b << fData;
//b << fAlias;
b << fTableAlias;
b << (uint32_t) fSequence;
b << static_cast<const ByteStream::doublebyte>(fIsInfiniDB);
@@ -363,7 +362,6 @@ void SimpleColumn::unserialize(messageqcpp::ByteStream& b)
b >> fViewName;
b >> (uint32_t&) fOid;
b >> fData;
//b >> fAlias;
b >> fTableAlias;
b >> (uint32_t&) fSequence;
b >> reinterpret_cast< ByteStream::doublebyte&>(fIsInfiniDB);
@@ -388,8 +386,6 @@ bool SimpleColumn::operator==(const SimpleColumn& t) const
if (fColumnName != t.fColumnName)
return false;
// if (fIndexName != t.fIndexName)
// return false;
if (fViewName != t.fViewName)
return false;
@@ -399,8 +395,6 @@ bool SimpleColumn::operator==(const SimpleColumn& t) const
if (data() != t.data())
return false;
// if (fAlias != t.fAlias)
// return false;
if (fTableAlias != t.fTableAlias)
return false;

View File

@@ -398,20 +398,29 @@ void FIFO<element_t>::signalPs()
template<typename element_t>
inline bool FIFO<element_t>::next(uint64_t id, element_t* out)
{
base::mutex.lock();
fConsumptionStarted = true;
if (cpos[id] >= fMaxElements)
{
base::mutex.unlock();
if (!waitForSwap(id))
return false;
base::mutex.lock();
}
*out = cBuffer[cpos[id]++];
#ifndef ONE_CS
if (cpos[id] == fMaxElements)
{
base::mutex.unlock();
signalPs();
return true;
}
#endif
base::mutex.unlock();
return true;
}

View File

@@ -1820,8 +1820,11 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
}
else if (ci.columnTypes[colpos].colWidth < 16777216)
{
dataLength = *(uint32_t*) buf;
buf = buf + 3 ;
dataLength = *(uint16_t*) buf;
buf = buf + 2 ;
if (*(uint8_t*)buf)
dataLength += 256*256*(*(uint8_t*)buf) ;
buf++;
}
else
{

View File

@@ -1548,8 +1548,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
ifp->functype() == Item_func::ISNOTNULL_FUNC)
{
ReturnedColumn* rhs = NULL;
if (!gwip->rcWorkStack.empty())
if (!gwip->rcWorkStack.empty() && !gwip->inCaseStmt)
{
rhs = gwip->rcWorkStack.top();
gwip->rcWorkStack.pop();
@@ -1650,8 +1649,49 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
idbassert(ifp->argument_count() == 1);
ParseTree* ptp = 0;
if (((Item_func*)(ifp->arguments()[0]))->functype() == Item_func::EQUAL_FUNC)
{
// negate it in place
// Note that an EQUAL_FUNC ( a <=> b) was converted to
// ( a = b OR ( a is null AND b is null) )
// NOT of the above expression is: ( a != b AND (a is not null OR b is not null )
if (isPredicateFunction(ifp->arguments()[0], gwip) || ifp->arguments()[0]->type() == Item::COND_ITEM)
if (!gwip->ptWorkStack.empty())
ptp = gwip->ptWorkStack.top();
if (ptp)
{
ParseTree* or_ptp = ptp;
ParseTree* and_ptp = or_ptp->right();
ParseTree* equal_ptp = or_ptp->left();
ParseTree* nullck_left_ptp = and_ptp->left();
ParseTree* nullck_right_ptp = and_ptp->right();
SimpleFilter *sf_left_nullck = dynamic_cast<SimpleFilter*>(nullck_left_ptp->data());
SimpleFilter *sf_right_nullck = dynamic_cast<SimpleFilter*>(nullck_right_ptp->data());
SimpleFilter *sf_equal = dynamic_cast<SimpleFilter*>(equal_ptp->data());
if (sf_left_nullck && sf_right_nullck && sf_equal) {
// Negate the null checks
sf_left_nullck->op()->reverseOp();
sf_right_nullck->op()->reverseOp();
sf_equal->op()->reverseOp();
// Rehook the nodes
ptp = and_ptp;
ptp->left(equal_ptp);
ptp->right(or_ptp);
or_ptp->left(nullck_left_ptp);
or_ptp->right(nullck_right_ptp);
gwip->ptWorkStack.pop();
gwip->ptWorkStack.push(ptp);
}
else {
gwip->fatalParseError = true;
gwip->parseErrorText = IDBErrorInfo::instance()->errorMsg(ERR_ASSERTION_FAILURE);
return false;
}
}
}
else if (isPredicateFunction(ifp->arguments()[0], gwip) || ifp->arguments()[0]->type() == Item::COND_ITEM)
{
// negate it in place
if (!gwip->ptWorkStack.empty())
@@ -1725,7 +1765,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
}
else if (ifp->functype() == Item_func::EQUAL_FUNC)
{
// a = b OR (a IS NULL AND b IS NULL)
// Convert "a <=> b" to (a = b OR (a IS NULL AND b IS NULL))"
idbassert (gwip->rcWorkStack.size() >= 2);
ReturnedColumn* rhs = gwip->rcWorkStack.top();
gwip->rcWorkStack.pop();
@@ -1737,7 +1777,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
// b IS NULL
ConstantColumn* nlhs1 = new ConstantColumn("", ConstantColumn::NULLDATA);
sop.reset(new PredicateOperator("isnull"));
sop->setOpType(lhs->resultType(), rhs->resultType());
sop->setOpType(lhs->resultType(), rhs->resultType());
sfn1 = new SimpleFilter(sop, rhs, nlhs1);
ParseTree* ptpl = new ParseTree(sfn1);
// a IS NULL
@@ -1752,7 +1792,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip)
ptpn->right(ptpr);
// a = b
sop.reset(new PredicateOperator("="));
sop->setOpType(lhs->resultType(), lhs->resultType());
sop->setOpType(lhs->resultType(), rhs->resultType());
sfo = new SimpleFilter(sop, lhs->clone(), rhs->clone());
// OR with the NULL comparison tree
ParseTree* ptp = new ParseTree(new LogicOperator("or"));
@@ -3772,8 +3812,12 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS
if (funcName == "case_searched" &&
(i < arg_offset))
{
// MCOL-1472 Nested CASE with an ISNULL predicate. We don't want the predicate
// to pull off of rcWorkStack, so we set this inCaseStmt flag to tell it
// not to.
gwi.inCaseStmt = true;
sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport));
gwi.inCaseStmt = false;
if (!gwi.ptWorkStack.empty() && *gwi.ptWorkStack.top()->data() == sptp->data())
{
gwi.ptWorkStack.pop();
@@ -10228,3 +10272,4 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
}
// vim:ts=4 sw=4:

View File

@@ -1964,7 +1964,7 @@ uint32_t doUpdateDelete(THD* thd)
}
else
{
thd->set_row_count_func(dmlRowCount);
thd->set_row_count_func(dmlRowCount+thd->get_row_count_func());
}
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, errorMsg.c_str());
@@ -1972,7 +1972,7 @@ uint32_t doUpdateDelete(THD* thd)
else
{
// if (dmlRowCount != 0) //Bug 5117. Handling self join.
thd->set_row_count_func(dmlRowCount);
thd->set_row_count_func(dmlRowCount+thd->get_row_count_func());
//cout << " error status " << ci->rc << " and rowcount = " << dmlRowCount << endl;

View File

@@ -149,6 +149,9 @@ struct gp_walk_info
int32_t recursionHWM;
std::stack<int32_t> rcBookMarkStack;
// Kludge for MCOL-1472
bool inCaseStmt;
gp_walk_info() : sessionid(0),
fatalParseError(false),
condPush(false),
@@ -164,7 +167,8 @@ struct gp_walk_info
lastSub(0),
derivedTbCnt(0),
recursionLevel(-1),
recursionHWM(0)
recursionHWM(0),
inCaseStmt(false)
{}
~gp_walk_info() {}