diff --git a/dbcon/ddlpackageproc/createtableprocessor.cpp b/dbcon/ddlpackageproc/createtableprocessor.cpp index 1b66c9092..db1e8d088 100644 --- a/dbcon/ddlpackageproc/createtableprocessor.cpp +++ b/dbcon/ddlpackageproc/createtableprocessor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/dmlpackage/dml.y b/dbcon/dmlpackage/dml.y index b26319c0b..73dcf26ea 100644 --- a/dbcon/dmlpackage/dml.y +++ b/dbcon/dmlpackage/dml.y @@ -566,17 +566,11 @@ assignment_commalist: assignment: column COMPARISON scalar_exp { - $$ = new ColumnAssignment(); - $$->fColumn = $1; - $$->fOperator = $2; - $$->fScalarExpression = $3; + $$ = new ColumnAssignment($1, $2, $3); } | column COMPARISON NULLX { - $$ = new ColumnAssignment(); - $$->fColumn = $1; - $$->fOperator = $2; - $$->fScalarExpression = $3; + $$ = new ColumnAssignment($1, $2, $3); } ; diff --git a/dbcon/dmlpackage/dmlpkg.h b/dbcon/dmlpackage/dmlpkg.h index 477e0f608..f7377f8a3 100644 --- a/dbcon/dmlpackage/dmlpkg.h +++ b/dbcon/dmlpackage/dmlpkg.h @@ -409,6 +409,14 @@ public: class ColumnAssignment { public: + explicit ColumnAssignment( + std::string const& column, + std::string const& op = "=", + std::string const& expr = "") : + fColumn(column), fOperator(op), fScalarExpression(expr), + fFromCol(false), fFuncScale(0), fIsNull(false) + {}; + /** @brief dump to stdout */ std::ostream& put(std::ostream& os) const; @@ -423,6 +431,7 @@ public: std::string fScalarExpression; bool fFromCol; uint32_t fFuncScale; + bool fIsNull; }; /** @brief Stores a value list or a query specification diff --git a/dbcon/dmlpackage/updatedmlpackage.cpp b/dbcon/dmlpackage/updatedmlpackage.cpp index a68e42fba..23b42a8dd 100644 --- a/dbcon/dmlpackage/updatedmlpackage.cpp +++ b/dbcon/dmlpackage/updatedmlpackage.cpp @@ -259,7 +259,8 @@ void UpdateDMLPackage::buildUpdateFromMysqlBuffer(UpdateSqlStatement& updateStm while (iter != updateStmt.fColAssignmentListPtr->end()) { ColumnAssignment* colaPtr = *iter; - DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, colaPtr->fScalarExpression, colaPtr->fFromCol, colaPtr->fFuncScale); + DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, colaPtr->fScalarExpression, colaPtr->fFromCol, colaPtr->fFuncScale, + colaPtr->fIsNull); rowPtr->get_ColumnList().push_back(colPtr); ++iter; diff --git a/dbcon/execplan/aggregatecolumn.cpp b/dbcon/execplan/aggregatecolumn.cpp index 8583459da..3d7825dcb 100644 --- a/dbcon/execplan/aggregatecolumn.cpp +++ b/dbcon/execplan/aggregatecolumn.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/aggregatecolumn.h b/dbcon/execplan/aggregatecolumn.h index 0825f00ff..20b049dad 100644 --- a/dbcon/execplan/aggregatecolumn.h +++ b/dbcon/execplan/aggregatecolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/arithmeticcolumn.cpp b/dbcon/execplan/arithmeticcolumn.cpp index aab6c9265..2128a47ed 100644 --- a/dbcon/execplan/arithmeticcolumn.cpp +++ b/dbcon/execplan/arithmeticcolumn.cpp @@ -326,7 +326,8 @@ void ArithmeticColumn::serialize(messageqcpp::ByteStream& b) const ObjectReader::writeParseTree(fExpression, b); b << fTableAlias; b << fData; - b << static_cast(fAsc); + const ByteStream::doublebyte tmp = fAsc; + b << tmp; } void ArithmeticColumn::unserialize(messageqcpp::ByteStream& b) @@ -340,7 +341,9 @@ void ArithmeticColumn::unserialize(messageqcpp::ByteStream& b) fExpression = ObjectReader::createParseTree(b); b >> fTableAlias; b >> fData; - b >> reinterpret_cast< ByteStream::doublebyte&>(fAsc); + ByteStream::doublebyte tmp; + b >> tmp; + fAsc = (tmp); fSimpleColumnList.clear(); fExpression->walk(getSimpleCols, &fSimpleColumnList); diff --git a/dbcon/execplan/arithmeticcolumn.h b/dbcon/execplan/arithmeticcolumn.h index d7e895969..2dfed7349 100644 --- a/dbcon/execplan/arithmeticcolumn.h +++ b/dbcon/execplan/arithmeticcolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/arithmeticoperator.h b/dbcon/execplan/arithmeticoperator.h index cc6cc70da..7277ccd65 100644 --- a/dbcon/execplan/arithmeticoperator.h +++ b/dbcon/execplan/arithmeticoperator.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/calpontselectexecutionplan.h b/dbcon/execplan/calpontselectexecutionplan.h index 3e4eedcbf..e21cd96bb 100644 --- a/dbcon/execplan/calpontselectexecutionplan.h +++ b/dbcon/execplan/calpontselectexecutionplan.h @@ -548,6 +548,10 @@ public: return fDerivedTbAlias; } + void derivedTbView(const std::string derivedTbView) { fDerivedTbView = derivedTbView; } + const std::string derivedTbView() const { return fDerivedTbView; } + + void limitStart(const uint64_t limitStart) { fLimitStart = limitStart; @@ -870,6 +874,7 @@ private: // for subselect uint64_t fSubType; std::string fDerivedTbAlias; + std::string fDerivedTbView; // for limit uint64_t fLimitStart; diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 27d9724fb..aa369e005 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index 383896fef..50248eb13 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/constantcolumn.cpp b/dbcon/execplan/constantcolumn.cpp index aa2676816..8b7e9fc42 100644 --- a/dbcon/execplan/constantcolumn.cpp +++ b/dbcon/execplan/constantcolumn.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/constantcolumn.h b/dbcon/execplan/constantcolumn.h index 51b914be0..bdeb1e014 100644 --- a/dbcon/execplan/constantcolumn.h +++ b/dbcon/execplan/constantcolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/functioncolumn.cpp b/dbcon/execplan/functioncolumn.cpp index c815a3cb2..03ef4ab39 100644 --- a/dbcon/execplan/functioncolumn.cpp +++ b/dbcon/execplan/functioncolumn.cpp @@ -426,6 +426,16 @@ void FunctionColumn::setDerivedTable() break; } } + // MCOL-3239 Block for func column with both + // derived table column and normal table column. + else if (derivedTableAlias == "") + { + if (sc->tableAlias().length()) + { + derivedTableAlias = ""; + break; + } + } } fDerivedTable = derivedTableAlias; diff --git a/dbcon/execplan/functioncolumn.h b/dbcon/execplan/functioncolumn.h index 99e3c9be7..c8274e087 100644 --- a/dbcon/execplan/functioncolumn.h +++ b/dbcon/execplan/functioncolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/operator.h b/dbcon/execplan/operator.h index b8d2ab18c..a8119fd6e 100644 --- a/dbcon/execplan/operator.h +++ b/dbcon/execplan/operator.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/parsetree.h b/dbcon/execplan/parsetree.h index 3561d9dc6..f31a2a013 100644 --- a/dbcon/execplan/parsetree.h +++ b/dbcon/execplan/parsetree.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/predicateoperator.cpp b/dbcon/execplan/predicateoperator.cpp index 501bd8a73..efd748c99 100644 --- a/dbcon/execplan/predicateoperator.cpp +++ b/dbcon/execplan/predicateoperator.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/predicateoperator.h b/dbcon/execplan/predicateoperator.h index 75cde2051..02a38efe4 100644 --- a/dbcon/execplan/predicateoperator.h +++ b/dbcon/execplan/predicateoperator.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -36,7 +36,6 @@ #endif #include #include -#include #include "expressionparser.h" #include "returnedcolumn.h" @@ -486,20 +485,16 @@ inline bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, Retu return !ret; } - // MCOL-1559 - std::string val1 = lop->getStrVal(row, isNull); if (isNull) return false; - std::string val2 = rop->getStrVal(row, isNull); + const std::string& val1 = lop->getStrVal(row, isNull); + if (isNull) return false; - boost::trim_right_if(val1, boost::is_any_of(" ")); - boost::trim_right_if(val2, boost::is_any_of(" ")); - - return strCompare(val1, val2); - } + return strCompare(val1, rop->getStrVal(row, isNull)) && !isNull; + } //FIXME: ??? case execplan::CalpontSystemCatalog::VARBINARY: diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index 0e43390bf..3c98536b6 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -212,9 +212,9 @@ const string SimpleColumn::data() const if (!fData.empty()) return fData; else if (!fTableAlias.empty()) - return string(fSchemaName + '.' + fTableAlias + '.' + fColumnName); + return string("`" + fSchemaName + "`.`" + fTableAlias + "`.`" + fColumnName + "`"); - return string(fSchemaName + '.' + fTableName + '.' + fColumnName); + return string("`" + fSchemaName + "`.`" + fTableName + "`.`" + fColumnName + "`"); } SimpleColumn& SimpleColumn::operator=(const SimpleColumn& rhs) diff --git a/dbcon/execplan/simplecolumn.h b/dbcon/execplan/simplecolumn.h index 45332f695..72f633a25 100644 --- a/dbcon/execplan/simplecolumn.h +++ b/dbcon/execplan/simplecolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/simplecolumn_decimal.h b/dbcon/execplan/simplecolumn_decimal.h index ce973134a..c49b597c5 100644 --- a/dbcon/execplan/simplecolumn_decimal.h +++ b/dbcon/execplan/simplecolumn_decimal.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/simplecolumn_int.h b/dbcon/execplan/simplecolumn_int.h index 4481e0fea..9454bba86 100644 --- a/dbcon/execplan/simplecolumn_int.h +++ b/dbcon/execplan/simplecolumn_int.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/simplecolumn_uint.h b/dbcon/execplan/simplecolumn_uint.h index c893c1a30..731242809 100644 --- a/dbcon/execplan/simplecolumn_uint.h +++ b/dbcon/execplan/simplecolumn_uint.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/simplefilter.h b/dbcon/execplan/simplefilter.h index e448aa3ed..f1711082e 100644 --- a/dbcon/execplan/simplefilter.h +++ b/dbcon/execplan/simplefilter.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/tdriver-sm.cpp b/dbcon/execplan/tdriver-sm.cpp index 860415471..853909eed 100644 --- a/dbcon/execplan/tdriver-sm.cpp +++ b/dbcon/execplan/tdriver-sm.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/tdriver.cpp b/dbcon/execplan/tdriver.cpp index 5a8675586..080c54ee7 100644 --- a/dbcon/execplan/tdriver.cpp +++ b/dbcon/execplan/tdriver.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index 84d2ccfac..606819dcb 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/windowfunctioncolumn.cpp b/dbcon/execplan/windowfunctioncolumn.cpp index 09ba50ddc..2316cb510 100644 --- a/dbcon/execplan/windowfunctioncolumn.cpp +++ b/dbcon/execplan/windowfunctioncolumn.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/execplan/windowfunctioncolumn.h b/dbcon/execplan/windowfunctioncolumn.h index 8dee14ece..2d06b735e 100644 --- a/dbcon/execplan/windowfunctioncolumn.h +++ b/dbcon/execplan/windowfunctioncolumn.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/batchprimitiveprocessor-jl.cpp b/dbcon/joblist/batchprimitiveprocessor-jl.cpp index d8aab62b4..5481a6de9 100644 --- a/dbcon/joblist/batchprimitiveprocessor-jl.cpp +++ b/dbcon/joblist/batchprimitiveprocessor-jl.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index 07ab611e7..bf44e1a6e 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -731,17 +731,17 @@ void CrossEngineStep::setProjectBPP(JobStep* jobStep1, JobStep*) else fSelectClause += "SELECT "; - fSelectClause += jobStep1->name(); + fSelectClause += "`" + jobStep1->name() + "`"; } std::string CrossEngineStep::makeQuery() { ostringstream oss; - oss << fSelectClause << " FROM " << fTable; + oss << fSelectClause << " FROM `" << fTable << "`"; if (fTable.compare(fAlias) != 0) - oss << " " << fAlias; + oss << " `" << fAlias << "`"; if (!fWhereClause.empty()) oss << fWhereClause; diff --git a/dbcon/joblist/groupconcat.cpp b/dbcon/joblist/groupconcat.cpp index 1433bd012..3479dd015 100644 --- a/dbcon/joblist/groupconcat.cpp +++ b/dbcon/joblist/groupconcat.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/jlf_common.cpp b/dbcon/joblist/jlf_common.cpp index cd690bb12..576358ea2 100644 --- a/dbcon/joblist/jlf_common.cpp +++ b/dbcon/joblist/jlf_common.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -386,19 +386,59 @@ CalpontSystemCatalog::OID tableOid(const SimpleColumn* sc, boost::shared_ptr(sc); uint32_t pseudoType = (pc) ? pc->pseudoType() : execplan::PSEUDO_UNKNOWN; - return getTupleKey_(jobInfo, sc->oid(), sc->columnName(), extractTableAlias(sc), - sc->schemaName(), sc->viewName(), - ((sc->joinInfo() & execplan::JOIN_CORRELATED) != 0), - pseudoType, (sc->isColumnStore() ? 0 : 1)); + + if (sc == NULL) + { + return -1; + } + + if (add) + { + // setTupleInfo first if add is true, ok if already set. + if (sc->schemaName().empty()) + { + SimpleColumn tmp(*sc, jobInfo.sessionId); + tmp.oid(tableOid(sc, jobInfo.csc) + 1 + sc->colPosition()); + key = getTupleKey(jobInfo, &tmp); // sub-query should be there + } + else + { + CalpontSystemCatalog::ColType ct = sc->colType(); + string alias(extractTableAlias(sc)); + CalpontSystemCatalog::OID tblOid = tableOid(sc, jobInfo.csc); + TupleInfo ti(setTupleInfo(ct, sc->oid(), jobInfo, tblOid, sc, alias)); + key = ti.key; + + + CalpontSystemCatalog::OID dictOid = isDictCol(ct); + + if (dictOid > 0) + { + ti = setTupleInfo(ct, dictOid, jobInfo, tblOid, sc, alias); + jobInfo.keyInfo->dictKeyMap[key] = ti.key; + key = ti.key; + } + } + } + else + { + // TupleInfo is expected to be set already + return getTupleKey_(jobInfo, sc->oid(), sc->columnName(), extractTableAlias(sc), + sc->schemaName(), sc->viewName(), + ((sc->joinInfo() & execplan::JOIN_CORRELATED) != 0), + pseudoType, (sc->isColumnStore() ? 0 : 1)); + } + + return key; } - - + uint32_t getTupleKey(JobInfo& jobInfo, const SRCP& srcp, bool add) { int key = -1; @@ -608,7 +648,7 @@ uint32_t getExpTupleKey(const JobInfo& jobInfo, uint64_t eid, bool cr) } -void addAggregateColumn(AggregateColumn* agc, int idx, RetColsVector& vec, JobInfo& jobInfo) +void addAggregateColumn(ReturnedColumn* agc, int idx, RetColsVector& vec, JobInfo& jobInfo) { uint32_t eid = agc->expressionId(); setExpTupleInfo(agc->resultType(), eid, agc->alias(), jobInfo); diff --git a/dbcon/joblist/jlf_common.h b/dbcon/joblist/jlf_common.h index 76538eef9..6d8456a4b 100644 --- a/dbcon/joblist/jlf_common.h +++ b/dbcon/joblist/jlf_common.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -402,8 +402,9 @@ execplan::CalpontSystemCatalog::OID tableOid(const execplan::SimpleColumn* sc, /** @brief Returns the unique ID to be used in tupleInfo * */ -uint32_t getTupleKey(const JobInfo& jobInfo, - const execplan::SimpleColumn* sc); +uint32_t getTupleKey(JobInfo& jobInfo, + const execplan::SimpleColumn* sc, + bool add = false); uint32_t getTableKey(const JobInfo& jobInfo, execplan::CalpontSystemCatalog::OID tableOid, const std::string& alias, @@ -465,7 +466,7 @@ TupleInfo setExpTupleInfo(const execplan::ReturnedColumn* rc, JobInfo& jobInfo); /** @brief add an aggregate column info * */ -void addAggregateColumn(execplan::AggregateColumn*, int, RetColsVector&, JobInfo&); +void addAggregateColumn(execplan::ReturnedColumn*, int, RetColsVector&, JobInfo&); void makeJobSteps(execplan::CalpontSelectExecutionPlan* csep, JobInfo& jobInfo, JobStepVector& querySteps, JobStepVector& projectSteps, diff --git a/dbcon/joblist/jlf_execplantojoblist.cpp b/dbcon/joblist/jlf_execplantojoblist.cpp index 82e33564e..90d70b9b1 100644 --- a/dbcon/joblist/jlf_execplantojoblist.cpp +++ b/dbcon/joblist/jlf_execplantojoblist.cpp @@ -1644,6 +1644,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) string constval(cc->constval()); + CalpontSystemCatalog::OID dictOid = 0; CalpontSystemCatalog::ColType ct = sc->colType(); const PseudoColumn* pc = dynamic_cast(sc); diff --git a/dbcon/joblist/jlf_subquery.cpp b/dbcon/joblist/jlf_subquery.cpp index 0d57c1277..d08f700c4 100644 --- a/dbcon/joblist/jlf_subquery.cpp +++ b/dbcon/joblist/jlf_subquery.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/jlf_tuplejoblist.cpp b/dbcon/joblist/jlf_tuplejoblist.cpp index 5337215d2..b18584d6a 100644 --- a/dbcon/joblist/jlf_tuplejoblist.cpp +++ b/dbcon/joblist/jlf_tuplejoblist.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/joblist.cpp b/dbcon/joblist/joblist.cpp index bb71996c1..8a8a89065 100644 --- a/dbcon/joblist/joblist.cpp +++ b/dbcon/joblist/joblist.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/joblist.h b/dbcon/joblist/joblist.h index 3c73eff75..4940e038d 100644 --- a/dbcon/joblist/joblist.h +++ b/dbcon/joblist/joblist.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/joblistfactory.cpp b/dbcon/joblist/joblistfactory.cpp index 2c00d390f..b4cbafee0 100644 --- a/dbcon/joblist/joblistfactory.cpp +++ b/dbcon/joblist/joblistfactory.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -275,9 +275,11 @@ const JobStepVector doProject(const RetColsVector& retCols, JobInfo& jobInfo) if (retCols[i]->windowfunctionColumnList().size() > 0) jobInfo.expressionVec.push_back(key); - else if (find(jobInfo.expressionVec.begin(), jobInfo.expressionVec.end(), key) == - jobInfo.expressionVec.end()) + else if (find(jobInfo.expressionVec.begin(), jobInfo.expressionVec.end(), key) + == jobInfo.expressionVec.end()) + { jobInfo.returnedExpressions.push_back(sjstep); + } //put place hold column in projection list jobInfo.pjColList.push_back(ti); @@ -427,7 +429,7 @@ void preProcessFunctionOnAggregation(const vector& scs, } } - // append the aggregate columns in arithmetic/function cloulmn to the projection list + // append the aggregate columns in arithmetic/function column to the projection list for (vector::const_iterator i = aggs.begin(); i != aggs.end(); i++) { addAggregateColumn(*i, -1, jobInfo.projectionCols, jobInfo); @@ -1043,16 +1045,21 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo const FunctionColumn* fc = NULL; const WindowFunctionColumn* wc = NULL; bool hasAggCols = false; + bool hasWndCols = false; if ((ac = dynamic_cast(srcp.get())) != NULL) { if (ac->aggColumnList().size() > 0) hasAggCols = true; + if (ac->windowfunctionColumnList().size() > 0) + hasWndCols = true; } else if ((fc = dynamic_cast(srcp.get())) != NULL) { if (fc->aggColumnList().size() > 0) hasAggCols = true; + if (fc->windowfunctionColumnList().size() > 0) + hasWndCols = true; } else if (dynamic_cast(srcp.get()) != NULL) { @@ -1077,7 +1084,7 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo TupleInfo ti(setExpTupleInfo(ct, eid, srcp.get()->alias(), jobInfo)); tupleKey = ti.key; - if (hasAggCols) + if (hasAggCols && !hasWndCols) jobInfo.expressionVec.push_back(tupleKey); } @@ -1191,16 +1198,21 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo const FunctionColumn* fc = NULL; const WindowFunctionColumn* wc = NULL; bool hasAggCols = false; + bool hasWndCols = false; if ((ac = dynamic_cast(srcp.get())) != NULL) { if (ac->aggColumnList().size() > 0) hasAggCols = true; + if (ac->windowfunctionColumnList().size() > 0) + hasWndCols = true; } else if ((fc = dynamic_cast(srcp.get())) != NULL) { if (fc->aggColumnList().size() > 0) hasAggCols = true; + if (fc->windowfunctionColumnList().size() > 0) + hasWndCols = true; } else if (dynamic_cast(srcp.get()) != NULL) { @@ -1225,7 +1237,7 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo TupleInfo ti(setExpTupleInfo(ct, eid, srcp.get()->alias(), jobInfo)); tupleKey = ti.key; - if (hasAggCols) + if (hasAggCols && !hasWndCols) jobInfo.expressionVec.push_back(tupleKey); } diff --git a/dbcon/joblist/joblisttypes.h b/dbcon/joblist/joblisttypes.h index c40c949c1..6d5664c57 100644 --- a/dbcon/joblist/joblisttypes.h +++ b/dbcon/joblist/joblisttypes.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/largehashjoin.cpp b/dbcon/joblist/largehashjoin.cpp index 4cf911405..9627a50db 100644 --- a/dbcon/joblist/largehashjoin.cpp +++ b/dbcon/joblist/largehashjoin.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/lbidlist.cpp b/dbcon/joblist/lbidlist.cpp index 9ef9c8a11..631e9a597 100644 --- a/dbcon/joblist/lbidlist.cpp +++ b/dbcon/joblist/lbidlist.cpp @@ -750,7 +750,6 @@ bool LBIDList::CasualPartitionPredicate(const int64_t Min, int64_t tMax = Max; dataconvert::DataConvert::trimWhitespace(tMin); dataconvert::DataConvert::trimWhitespace(tMax); - dataconvert::DataConvert::trimWhitespace(value); scan = compareVal(order_swap(tMin), order_swap(tMax), order_swap(value), op, lcf); diff --git a/dbcon/joblist/primitivestep.h b/dbcon/joblist/primitivestep.h index 588dd49bb..c6e9134ff 100644 --- a/dbcon/joblist/primitivestep.h +++ b/dbcon/joblist/primitivestep.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/subquerytransformer.cpp b/dbcon/joblist/subquerytransformer.cpp index 1118e92e8..b66bcb310 100644 --- a/dbcon/joblist/subquerytransformer.cpp +++ b/dbcon/joblist/subquerytransformer.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/tdriver-agg.cpp b/dbcon/joblist/tdriver-agg.cpp index f54831ab4..636d0c86a 100644 --- a/dbcon/joblist/tdriver-agg.cpp +++ b/dbcon/joblist/tdriver-agg.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index 990a694b1..81d190644 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -1410,7 +1410,7 @@ void TupleAggregateStep::prep1PhaseAggregate( typeAgg.push_back(CalpontSystemCatalog::LONGDOUBLE); precisionAgg.push_back(-1); widthAgg.push_back(sizeof(long double)); - scaleAgg.push_back(scaleProj[colProj]); + scaleAgg.push_back(0); } break; @@ -1588,8 +1588,8 @@ void TupleAggregateStep::prep1PhaseAggregate( } functionVec[i]->fAuxColumnIndex = lastCol++; - oidsAgg.push_back(oidsAgg[j]); - keysAgg.push_back(keysAgg[j]); + oidsAgg.push_back(oidsProj[j]); + keysAgg.push_back(keysProj[j]); scaleAgg.push_back(0); precisionAgg.push_back(0); precisionAgg.push_back(0); @@ -1604,8 +1604,8 @@ void TupleAggregateStep::prep1PhaseAggregate( functionVec[i]->fAuxColumnIndex = lastCol; // sum(x) - oidsAgg.push_back(oidsAgg[j]); - keysAgg.push_back(keysAgg[j]); + oidsAgg.push_back(oidsProj[j]); + keysAgg.push_back(keysProj[j]); scaleAgg.push_back(0); precisionAgg.push_back(-1); typeAgg.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -1613,8 +1613,8 @@ void TupleAggregateStep::prep1PhaseAggregate( ++lastCol; // sum(x**2) - oidsAgg.push_back(oidsAgg[j]); - keysAgg.push_back(keysAgg[j]); + oidsAgg.push_back(oidsProj[j]); + keysAgg.push_back(keysProj[j]); scaleAgg.push_back(0); precisionAgg.push_back(-1); typeAgg.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -1942,7 +1942,7 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate( typeAgg.push_back(CalpontSystemCatalog::LONGDOUBLE); precisionAgg.push_back(-1); widthAgg.push_back(sizeof(long double)); - scaleAgg.push_back(scaleProj[colProj]); + scaleAgg.push_back(0); colAgg++; // has distinct step, put the count column for avg next to the sum @@ -2264,7 +2264,7 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate( typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); precisionAggDist.push_back(-1); widthAggDist.push_back(sizeof(long double)); - scaleAggDist.push_back(scaleProj[colAgg]); + scaleAggDist.push_back(0); } break; @@ -2336,10 +2336,10 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate( { oidsAggDist.push_back(oidsAgg[colAgg]); keysAggDist.push_back(retKey); - scaleAggDist.push_back(scaleAgg[colAgg] >> 8); - precisionAggDist.push_back(precisionAgg[colAgg]); - typeAggDist.push_back(typeAgg[colAgg]); - widthAggDist.push_back(widthAgg[colAgg]); + scaleAggDist.push_back(0); + typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); + precisionAggDist.push_back(-1); + widthAggDist.push_back(sizeof(long double)); } else { @@ -2631,8 +2631,8 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate( functionVec2[i]->fAuxColumnIndex = lastCol; // sum(x) - oidsAggDist.push_back(oidsAggDist[j]); - keysAggDist.push_back(keysAggDist[j]); + oidsAggDist.push_back(oidsAgg[j]); + keysAggDist.push_back(keysAgg[j]); scaleAggDist.push_back(0); precisionAggDist.push_back(0); typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -2640,8 +2640,8 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate( ++lastCol; // sum(x**2) - oidsAggDist.push_back(oidsAggDist[j]); - keysAggDist.push_back(keysAggDist[j]); + oidsAggDist.push_back(oidsAgg[j]); + keysAggDist.push_back(keysAgg[j]); scaleAggDist.push_back(0); precisionAggDist.push_back(-1); typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -3188,7 +3188,7 @@ void TupleAggregateStep::prep2PhasesAggregate( oidsAggPm.push_back(oidsProj[colProj]); keysAggPm.push_back(aggKey); typeAggPm.push_back(CalpontSystemCatalog::LONGDOUBLE); - scaleAggPm.push_back(scaleProj[colProj]); + scaleAggPm.push_back(0); precisionAggPm.push_back(-1); widthAggPm.push_back(sizeof(long double)); colAggPm++; @@ -3465,10 +3465,10 @@ void TupleAggregateStep::prep2PhasesAggregate( { oidsAggUm.push_back(oidsAggPm[colPm]); keysAggUm.push_back(retKey); - scaleAggUm.push_back(scaleAggPm[colPm] >> 8); - precisionAggUm.push_back(precisionAggPm[colPm]); - typeAggUm.push_back(typeAggPm[colPm]); - widthAggUm.push_back(widthAggPm[colPm]); + scaleAggUm.push_back(0); + typeAggUm.push_back(CalpontSystemCatalog::LONGDOUBLE); + precisionAggUm.push_back(-1); + widthAggUm.push_back(sizeof(long double)); } else { @@ -3683,8 +3683,8 @@ void TupleAggregateStep::prep2PhasesAggregate( functionVecUm[i]->fAuxColumnIndex = lastCol; // sum(x) - oidsAggUm.push_back(oidsAggUm[j]); - keysAggUm.push_back(keysAggUm[j]); + oidsAggUm.push_back(oidsAggPm[j]); + keysAggUm.push_back(keysAggPm[j]); scaleAggUm.push_back(0); precisionAggUm.push_back(-1); typeAggUm.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -3692,8 +3692,8 @@ void TupleAggregateStep::prep2PhasesAggregate( ++lastCol; // sum(x**2) - oidsAggUm.push_back(oidsAggUm[j]); - keysAggUm.push_back(keysAggUm[j]); + oidsAggUm.push_back(oidsAggPm[j]); + keysAggUm.push_back(keysAggPm[j]); scaleAggUm.push_back(0); precisionAggUm.push_back(-1); typeAggUm.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -4046,7 +4046,7 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate( typeAggPm.push_back(CalpontSystemCatalog::LONGDOUBLE); precisionAggPm.push_back(-1); widthAggPm.push_back(sizeof(long double)); - scaleAggPm.push_back(scaleProj[colProj]); + scaleAggPm.push_back(0); colAggPm++; } @@ -4415,7 +4415,7 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate( typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); precisionAggDist.push_back(-1); widthAggDist.push_back(sizeof(long double)); - scaleAggDist.push_back(scaleAggUm[colUm]); + scaleAggDist.push_back(0); } // PM: put the count column for avg next to the sum // let fall through to add a count column for average function @@ -4477,10 +4477,10 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate( { oidsAggDist.push_back(oidsAggUm[colUm]); keysAggDist.push_back(retKey); - scaleAggDist.push_back(scaleAggUm[colUm] >> 8); - precisionAggDist.push_back(precisionAggUm[colUm]); - typeAggDist.push_back(typeAggUm[colUm]); - widthAggDist.push_back(widthAggUm[colUm]); + scaleAggDist.push_back(0); + typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); + precisionAggDist.push_back(-1); + widthAggDist.push_back(sizeof(long double)); } else { @@ -4725,8 +4725,8 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate( functionVecUm[i]->fAuxColumnIndex = lastCol; // sum(x) - oidsAggDist.push_back(oidsAggDist[j]); - keysAggDist.push_back(keysAggDist[j]); + oidsAggDist.push_back(oidsAggPm[j]); + keysAggDist.push_back(keysAggPm[j]); scaleAggDist.push_back(0); precisionAggDist.push_back(-1); typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -4734,8 +4734,8 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate( ++lastCol; // sum(x**2) - oidsAggDist.push_back(oidsAggDist[j]); - keysAggDist.push_back(keysAggDist[j]); + oidsAggDist.push_back(oidsAggPm[j]); + keysAggDist.push_back(keysAggPm[j]); scaleAggDist.push_back(0); precisionAggDist.push_back(-1); typeAggDist.push_back(CalpontSystemCatalog::LONGDOUBLE); @@ -5038,7 +5038,8 @@ void TupleAggregateStep::prepExpressionOnAggregate(SP_ROWAGG_UM_t& aggUM, JobInf uint64_t eid = -1; if (((ac = dynamic_cast(it->get())) != NULL) && - (ac->aggColumnList().size() > 0)) + (ac->aggColumnList().size() > 0) && + (ac->windowfunctionColumnList().size() == 0)) { const vector& scols = ac->simpleColumnList(); simpleColumns.insert(simpleColumns.end(), scols.begin(), scols.end()); @@ -5047,7 +5048,8 @@ void TupleAggregateStep::prepExpressionOnAggregate(SP_ROWAGG_UM_t& aggUM, JobInf expressionVec.push_back(*it); } else if (((fc = dynamic_cast(it->get())) != NULL) && - (fc->aggColumnList().size() > 0)) + (fc->aggColumnList().size() > 0) && + (fc->windowfunctionColumnList().size() == 0)) { const vector& sCols = fc->simpleColumnList(); simpleColumns.insert(simpleColumns.end(), sCols.begin(), sCols.end()); diff --git a/dbcon/joblist/tupleconstantstep.cpp b/dbcon/joblist/tupleconstantstep.cpp index 02f61eb9c..4ffb811e7 100644 --- a/dbcon/joblist/tupleconstantstep.cpp +++ b/dbcon/joblist/tupleconstantstep.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/tupleunion.cpp b/dbcon/joblist/tupleunion.cpp index 666b0d514..f3cab8ddf 100644 --- a/dbcon/joblist/tupleunion.cpp +++ b/dbcon/joblist/tupleunion.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/joblist/windowfunctionstep.cpp b/dbcon/joblist/windowfunctionstep.cpp index 610026e33..b145bfa12 100644 --- a/dbcon/joblist/windowfunctionstep.cpp +++ b/dbcon/joblist/windowfunctionstep.cpp @@ -320,6 +320,41 @@ const string WindowFunctionStep::toString() const return oss.str(); } +void WindowFunctionStep::AddSimplColumn(const vector& scs, + JobInfo& jobInfo) +{ + // append the simple columns if not already projected + set scProjected; + + for (RetColsVector::iterator i = jobInfo.projectionCols.begin(); + i != jobInfo.projectionCols.end(); + i++) + { + SimpleColumn* sc = dynamic_cast(i->get()); + + if (sc != NULL) + { + if (sc->schemaName().empty()) + sc->oid(joblist::tableOid(sc, jobInfo.csc) + 1 + sc->colPosition()); + + scProjected.insert(UniqId(sc)); + } + } + + for (vector::const_iterator i = scs.begin(); i != scs.end(); i++) + { + if (scProjected.find(UniqId(*i)) == scProjected.end()) + { + jobInfo.windowDels.push_back(SRCP((*i)->clone())); +// MCOL-3343 Enable this if we decide to allow Window Functions to run with +// aggregates with no group by. MariaDB allows this. Nobody else in the world does. +// There will be more work to get it to function if we try this. +// jobInfo.windowSet.insert(getTupleKey(jobInfo, *i, true)); + scProjected.insert(UniqId(*i)); + } + } +} + void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo) { // window functions in select clause, selected or in expression @@ -404,6 +439,23 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J if (jobInfo.windowCols.empty()) return; + // Add in the non-window side of arithmetic columns and functions + for (uint64_t i = 0; i < jobInfo.windowExps.size(); i++) + { + const ArithmeticColumn* ac = + dynamic_cast(jobInfo.windowExps[i].get()); + const FunctionColumn* fc = + dynamic_cast(jobInfo.windowExps[i].get()); + + if (ac != NULL && ac->windowfunctionColumnList().size() > 0) + { + AddSimplColumn(ac->simpleColumnList(), jobInfo); + } + else if (fc != NULL && fc->windowfunctionColumnList().size() > 0) + { + AddSimplColumn(fc->simpleColumnList(), jobInfo); + } + } // reconstruct the delivered column list with auxiliary columns set colSet; jobInfo.deliveredCols.resize(0); @@ -445,7 +497,13 @@ void WindowFunctionStep::checkWindowFunction(CalpontSelectExecutionPlan* csep, J key = getTupleKey(jobInfo, *j, true); if (colSet.find(key) == colSet.end()) + { jobInfo.deliveredCols.push_back(*j); +// MCOL-3343 Enable this if we decide to allow Window Functions to run with +// aggregates with no group by. MariaDB allows this. Nobody else in the world does. +// There will be more work to get it to function if we try this. +// jobInfo.windowSet.insert(getTupleKey(jobInfo, *j, true)); + } colSet.insert(key); } diff --git a/dbcon/joblist/windowfunctionstep.h b/dbcon/joblist/windowfunctionstep.h index b57d06324..eaa020fc3 100644 --- a/dbcon/joblist/windowfunctionstep.h +++ b/dbcon/joblist/windowfunctionstep.h @@ -148,6 +148,8 @@ private: void formatMiniStats(); void printCalTrace(); + static void AddSimplColumn(const std::vector& scs, JobInfo& jobInfo); + class Runner { public: diff --git a/dbcon/mysql/CMakeLists.txt b/dbcon/mysql/CMakeLists.txt index 0aa6ddcc0..c74e19343 100644 --- a/dbcon/mysql/CMakeLists.txt +++ b/dbcon/mysql/CMakeLists.txt @@ -22,8 +22,6 @@ SET ( libcalmysql_SRCS ha_pseudocolumn.cpp) add_definitions(-DMYSQL_DYNAMIC_PLUGIN) -add_definitions(-DEBUG_WALK_COND) -add_definitions(-DINFINIDB_DEBUG) set_source_files_properties(ha_calpont.cpp PROPERTIES COMPILE_FLAGS "-fno-rtti -fno-implicit-templates") diff --git a/dbcon/mysql/columnstore_info.sql b/dbcon/mysql/columnstore_info.sql index 7655b5f16..b2f5e50d1 100644 --- a/dbcon/mysql/columnstore_info.sql +++ b/dbcon/mysql/columnstore_info.sql @@ -101,7 +101,7 @@ END // create procedure columnstore_upgrade() `columnstore_upgrade`: BEGIN DECLARE done INTEGER DEFAULT 0; - DECLARE schema_table VARCHAR(100) DEFAULT ""; + DECLARE schema_table VARCHAR(100) CHARACTER SET utf8 DEFAULT ""; DECLARE table_list CURSOR FOR select concat('`', table_schema,'`.`',table_name,'`') from information_schema.tables where engine='columnstore'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN table_list; @@ -115,6 +115,5 @@ create procedure columnstore_upgrade() DEALLOCATE PREPARE stmt; END LOOP; END // -delimiter ; DELIMITER ; diff --git a/dbcon/mysql/ha_calpont.cpp b/dbcon/mysql/ha_calpont.cpp index 419e2f853..4b1a0365c 100644 --- a/dbcon/mysql/ha_calpont.cpp +++ b/dbcon/mysql/ha_calpont.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -143,7 +143,7 @@ static int columnstore_init_func(void* p) mcs_hton->commit = calpont_commit; mcs_hton->rollback = calpont_rollback; mcs_hton->close_connection = calpont_close_connection; - //mcs_hton->create_group_by = create_calpont_group_by_handler; + mcs_hton->create_group_by = create_calpont_group_by_handler; mcs_hton->create_derived = create_columnstore_derived_handler; mcs_hton->create_select = create_columnstore_select_handler; DBUG_RETURN(0); diff --git a/dbcon/mysql/ha_calpont.h b/dbcon/mysql/ha_calpont.h index 5b9dcab56..8e0c90407 100644 --- a/dbcon/mysql/ha_calpont.h +++ b/dbcon/mysql/ha_calpont.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_calpont_ddl.cpp b/dbcon/mysql/ha_calpont_ddl.cpp index 05fb71203..1fc07be6d 100644 --- a/dbcon/mysql/ha_calpont_ddl.cpp +++ b/dbcon/mysql/ha_calpont_ddl.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_calpont_dml.cpp b/dbcon/mysql/ha_calpont_dml.cpp index d98322ab3..cb1f3853e 100644 --- a/dbcon/mysql/ha_calpont_dml.cpp +++ b/dbcon/mysql/ha_calpont_dml.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -1043,7 +1043,6 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_ dataLength = *(uint16_t*) buf; buf = buf + 2 ; } - escape.assign((char*)buf, dataLength); boost::replace_all(escape, "\\", "\\\\"); fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter); @@ -1061,22 +1060,16 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_ buf = buf + 2 ; } - if ( dataLength > ci.columnTypes[colpos].colWidth) - dataLength = ci.columnTypes[colpos].colWidth; - escape.assign((char*)buf, dataLength); boost::replace_all(escape, "\\", "\\\\"); fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter); } } - - //buf += ci.columnTypes[colpos].colWidth; if (ci.utf8) buf += (ci.columnTypes[colpos].colWidth * 3); else buf += ci.columnTypes[colpos].colWidth; - break; } diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 74eb18415..f9bd19d4e 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -207,7 +207,6 @@ bool nonConstFunc(Item_func* ifp) ***********************************************************/ void getColNameFromItem(std::ostringstream& ostream, Item* item) { -// MCOL-2121 WIP // Item_func doesn't have proper db.table.field values // inherited from Item_ident. TBD what is the valid output. // !!!dynamic_cast fails compilation @@ -1321,8 +1320,8 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex) { if (gwi.thd->derived_tables_processing) { -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = false; + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = false; gwi.cs_vtable_is_update_with_derive = true; return -1; } @@ -2364,8 +2363,15 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp) sc->colPosition(j); string tableAlias(csep->derivedTbAlias()); sc->tableAlias(lower(tableAlias)); - sc->viewName(lower(viewName)); sc->timeZone(gwi.thd->variables.time_zone->get_name()->ptr()); + if (!viewName.empty()) + { + sc->viewName(viewName); + } + else + { + sc->viewName(csep->derivedTbView()); + } sc->resultType(cols[j]->resultType()); sc->hasAggregate(cols[j]->hasAggregate()); @@ -5149,12 +5155,6 @@ void gp_walk(const Item* item, void* arg) gwip->rcWorkStack.push(buildReturnedColumn(itp, *gwip, gwip->fatalParseError)); break; } - /*case Item::VARBIN_ITEM: - { - Item_hex_string* hdp = (Item_hex_string*)item; - gwip->rcWorkStack.push(buildReturnedColumn(hdp, *gwip, gwip->fatalParseError)); - break; - }*/ default: { if (gwip->condPush) @@ -5622,8 +5622,8 @@ void gp_walk(const Item* item, void* arg) gwip->hasSubSelect = true; gwip->subQuery = existsSub; gwip->ptWorkStack.push(existsSub->transform()); -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = true; // only temp. bypass the 2nd phase. + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = true; // only temp. bypass the 2nd phase. // recover original gwip->subQuery = orig; gwip->lastSub = existsSub; @@ -5718,20 +5718,7 @@ void gp_walk(const Item* item, void* arg) printf("********** received TRIGGER_FIELD_ITEM *********\n"); break; - /* WIP MCOL-2178 - case Item::XPATH_NODESET: - printf("********** received XPATH_NODESET *********\n"); - break; - - case Item::XPATH_NODESET_CMP: - printf("********** received XPATH_NODESET_CMP *********\n"); - break; - - case Item::VIEW_FIXER_ITEM: - printf("********** received VIEW_FIXER_ITEM *********\n"); - break; - */ - case Item::TYPE_HOLDER: + case Item::TYPE_HOLDER: std::cerr << "********** received TYPE_HOLDER *********" << std::endl; break; default: @@ -5983,8 +5970,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI ) ) && gwi.thd->derived_tables_processing) { -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = false; + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = false; return -1; } @@ -6118,8 +6105,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, gwi.tbList.push_back(tn); CalpontSystemCatalog::TableAliasName tan = make_aliastable("", alias, alias); gwi.tableMap[tan] = make_pair(0, table_ptr); -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init } else if (table_ptr->view) { @@ -6190,8 +6177,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, // is_unit_op() give a segv for derived_handler's SELECT_LEX if (!isUnion && select_lex.master_unit()->is_unit_op()) { -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = true; + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = true; CalpontSelectExecutionPlan::SelectList unionVec; SELECT_LEX* select_cursor = select_lex.master_unit()->first_select(); unionSel = true; @@ -6283,8 +6270,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, // processing. if (gwi.thd->derived_tables_processing) { -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = false; + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = false; gwi.cs_vtable_is_update_with_derive = true; return -1; } @@ -6442,9 +6429,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, Item* item; vector funcFieldVec; - string sel_cols_in_select; - bool redo = false; - // empty rcWorkStack and ptWorkStack. They should all be empty by now. clearStacks(gwi); @@ -6509,12 +6493,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, } - if (ifp->is_autogenerated_name) - gwi.selectCols.push_back("`" + escapeBackTick(fullname.c_str()) + "`" + " `" + - escapeBackTick(itemAlias.empty() ? ifp->name.str : itemAlias.c_str()) + "`"); - else - gwi.selectCols.push_back("`" + escapeBackTick((itemAlias.empty() ? ifp->name.str : itemAlias.c_str())) + "`"); - gwi.returnedCols.push_back(spsc); gwi.columnMap.insert(CalpontSelectExecutionPlan::ColumnMap::value_type(string(ifp->field_name.str), spsc)); @@ -6552,10 +6530,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, // add this agg col to returnedColumnList boost::shared_ptr spac(ac); gwi.returnedCols.push_back(spac); - gwi.selectCols.push_back('`' + escapeBackTick(spac->alias().c_str()) + '`'); - String str(256); - item->print(&str, QT_ORDINARY); - break; } @@ -6717,11 +6691,17 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, break; } // End of FUNC_ITEM + // DRRTUY Replace the whole section with typeid() checks or use + // reinterpret_cast here case Item::CONST_ITEM: { switch(item->cmp_type()) { case INT_RESULT: + case STRING_RESULT: + case DECIMAL_RESULT: + case REAL_RESULT: + case TIME_RESULT: { if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) { } @@ -6738,71 +6718,15 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, srcp->alias(item->name.str); gwi.returnedCols.push_back(srcp); - - Item_int* isp = reinterpret_cast(item); - ostringstream oss; - oss << isp->value << " `" << escapeBackTick(srcp->alias().c_str()) << "`"; - - gwi.selectCols.push_back(oss.str()); } break; } - - case STRING_RESULT: - { - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - { } - else - { - SRCP srcp(buildReturnedColumn(item, gwi, gwi.fatalParseError)); - gwi.returnedCols.push_back(srcp); - - if (item->name.length) - srcp->alias(item->name.str); - - Item_string* isp = reinterpret_cast(item); - String val, *str = isp->val_str(&val); - string valStr; - valStr.assign(str->ptr(), str->length()); - string name = "'" + valStr + "'" + " " + "`" + escapeBackTick(srcp->alias().c_str()) + "`"; - - gwi.selectCols.push_back(name); - } - - break; - } - - case DECIMAL_RESULT: - { - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - { } - else - { - SRCP srcp(buildReturnedColumn(item, gwi, gwi.fatalParseError)); - gwi.returnedCols.push_back(srcp); - - if (item->name.length) - srcp->alias(item->name.str); - - Item_decimal* isp = reinterpret_cast(item); - String val, *str = isp->val_str(&val); - string valStr; - valStr.assign(str->ptr(), str->length()); - ostringstream oss; - oss << valStr.c_str() << " `" << escapeBackTick(srcp->alias().c_str()) << "`"; - - gwi.selectCols.push_back(oss.str()); - } - - break; - } - // WIP MCOL-2178 This switch doesn't handl - // ROW_, TIME_, REAL_RESULT and if one couldn't - // project the former two REAL is possible. - // Need to test before commit. + // MCOL-2178 This switch doesn't handl + // ROW_ default: { + IDEBUG(cerr << "Warning unsupported cmp_type() in projection" << endl); //noop } } @@ -6820,10 +6744,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, if (item->name.length) srcp->alias(item->name.str); - - string name = string("null `") + escapeBackTick(srcp->alias().c_str()) + string("`") ; - - gwi.selectCols.push_back("null"); } break; @@ -6880,17 +6800,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, rc->alias(sub->name.str); gwi.returnedCols.push_back(SRCP(rc)); - String str; - sub->get_select_lex()->print(gwi.thd, &str, QT_ORDINARY); - - if (sub->name.length) - { - gwi.selectCols.push_back(sub->name.str); - } - else - { - gwi.selectCols.push_back("`" + escapeBackTick(str.c_ptr()) + "`"); - } break; } @@ -7437,14 +7346,14 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, && ord_item->full_name() && !strcmp(ord_item->full_name(), "Not_used")) { - continue; + continue; } else if (ord_item->type() == Item::CONST_ITEM && ord_item->cmp_type() == INT_RESULT) { - // WIP MCOL-2178. We should seek smallest - // column here and not just previous. - rc = gwi.returnedCols[((Item_int*)ord_item)->val_int() - 1]->clone(); + // DRRTUY This section looks useless b/c there is no + // way to put constant INT into an ORDER BY list + rc = gwi.returnedCols[((Item_int*)ord_item)->val_int() - 1]->clone(); } else if (ord_item->type() == Item::SUBSELECT_ITEM) { @@ -7484,6 +7393,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, gwi.orderByCols.push_back(SRCP(rc)); } } + // DRRTUY The whole block is marked for removal in 1.4.1 +#if 0 else if (!isUnion) { vector fieldVec; @@ -7590,12 +7501,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, } } - } } - redo = (redo || fieldVec.size() != 0); - // populate string to be added to the select list for order by for (uint32_t i = 0; i < fieldVec.size(); i++) { @@ -7635,6 +7543,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, } } } +#endif // make sure columnmap, returnedcols and count(*) arg_list are not empty TableMap::iterator tb_iter = gwi.tableMap.begin(); @@ -7715,9 +7624,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, if (!isUnion && !gwi.hasWindowFunc && gwi.subSelectType == CalpontSelectExecutionPlan::MAIN_SELECT ) { - std::ostringstream vtb; - vtb << "infinidb_vtable.$vtable_" << gwi.thd->thread_id; - { if (unionSel) order_list = select_lex.master_unit()->global_parameters()->order_list; @@ -7760,12 +7666,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, } } } - else - { - String str; - ord_item->print(&str, QT_ORDINARY); - } - } } @@ -7982,35 +7882,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, return 0; } -int cp_get_plan(THD* thd, SCSEP& csep) -{ - LEX* lex = thd->lex; - idbassert(lex != 0); - - gp_walk_info gwi; - gwi.thd = thd; - - // WIP MCOL-2178 A questionable replacement. - SELECT_LEX select_lex = *lex->first_select_lex(); - int status = getSelectPlan(gwi, select_lex, csep); - - if (status > 0) - return ER_INTERNAL_ERROR; - else if (status < 0) - return status; - -#ifdef DEBUG_WALK_COND - cerr << "---------------- cp_get_plan EXECUTION PLAN ----------------" << endl; - cerr << *csep << endl ; - cerr << "-------------- EXECUTION PLAN END --------------\n" << endl; -#endif - - // Derived table projection and filter optimization. - derivedTableOptimization(thd, csep); - - return 0; -} - int cp_get_table_plan(THD* thd, SCSEP& csep, cal_table_info& ti) { gp_walk_info* gwi = ti.condInfo; @@ -8143,7 +8014,7 @@ int cs_get_derived_plan(derived_handler* handler, THD* thd, SCSEP& csep, gp_walk return status; #ifdef DEBUG_WALK_COND - cerr << "---------------- cp_get_derived_plan EXECUTION PLAN ----------------" << endl; + cerr << "---------------- cs_get_derived_plan EXECUTION PLAN ----------------" << endl; cerr << *csep << endl ; cerr << "-------------- EXECUTION PLAN END --------------\n" << endl; #endif @@ -8163,7 +8034,7 @@ int cs_get_select_plan(select_handler* handler, THD* thd, SCSEP& csep, gp_walk_i return status; #ifdef DEBUG_WALK_COND - cerr << "---------------- cp_get_select_plan EXECUTION PLAN ----------------" << endl; + cerr << "---------------- cs_get_select_plan EXECUTION PLAN ----------------" << endl; cerr << *csep << endl ; cerr << "-------------- EXECUTION PLAN END --------------\n" << endl; #endif @@ -8352,12 +8223,11 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro gwi.tbList.push_back(tn); CalpontSystemCatalog::TableAliasName tan = make_aliastable("", alias, alias); gwi.tableMap[tan] = make_pair(0, table_ptr); -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = true; //by-pass the 2nd pass of rnd_init } else if (table_ptr->view) { - // WIP MCOL-2178 A questionable replacement. View* view = new View(*table_ptr->view->first_select_lex(), &gwi); CalpontSystemCatalog::TableAliasName tn = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str); view->viewName(tn); @@ -8451,8 +8321,8 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro // processing. if (gwi.thd->derived_tables_processing) { -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = false; + // MCOL-2178 isUnion member only assigned, never used + //MIGR::infinidb_vtable.isUnion = false; return -1; } @@ -8622,12 +8492,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro } - if (ifp->is_autogenerated_name) - gwi.selectCols.push_back("`" + escapeBackTick(fullname.c_str()) + "`" + " `" + - escapeBackTick(itemAlias.empty() ? ifp->name.str : itemAlias.c_str()) + "`"); - else - gwi.selectCols.push_back("`" + escapeBackTick((itemAlias.empty() ? ifp->name.str : itemAlias.c_str())) + "`"); - // MCOL-1052 Replace SimpleColumn with ConstantColumn, // since it must have a single value only. if (constCol) @@ -8678,10 +8542,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro // This item could be used in projection or HAVING later. gwi.extSelAggColsItems.push_back(item); - gwi.selectCols.push_back('`' + escapeBackTick(spac->alias().c_str()) + '`'); - String str(256); - item->print(&str, QT_ORDINARY); - break; } @@ -8741,34 +8601,11 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro continue; } - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || - ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || - ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || - ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI ) ) - { } - else - { - redo = true; - String str; - ifp->print(&str, QT_ORDINARY); - gwi.selectCols.push_back(string(str.c_ptr()) + " " + "`" + escapeBackTick(item->name.str) + "`"); - } - break; } - //SRCP srcp(rc); gwi.returnedCols.push_back(srcp); - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - { } - else - { - String str(256); - ifp->print(&str, QT_ORDINARY); - - gwi.selectCols.push_back("`" + escapeBackTick(ifp->name.str) + "`"); - } } else // InfiniDB Non support functions still go through post process for now { @@ -8860,18 +8697,8 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro return -1; } } - - //@Bug 3021. Bypass postprocess for update and delete. - //if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - //{} else { - // @bug 3881. Here is the real redo part. - redo = true; - // @bug 1706 - String funcStr; - ifp->print(&funcStr, QT_ORDINARY); - gwi.selectCols.push_back(string(funcStr.c_ptr()) + " `" + escapeBackTick(ifp->name.str) + "`"); // clear the error set by buildFunctionColumn gwi.fatalParseError = false; gwi.parseErrorText = ""; @@ -8881,11 +8708,17 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro break; } + // DRRTUY Replace the whole section with typeid() checks or use + // reinterpret_cast here case Item::CONST_ITEM: { switch(item->cmp_type()) { case INT_RESULT: + case STRING_RESULT: + case DECIMAL_RESULT: + case REAL_RESULT: + case TIME_RESULT: { if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) { } @@ -8902,69 +8735,16 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro srcp->alias(item->name.str); gwi.returnedCols.push_back(srcp); - - Item_int* isp = reinterpret_cast(item); - ostringstream oss; - oss << isp->value << " `" << escapeBackTick(srcp->alias().c_str()) << "`"; - - gwi.selectCols.push_back(oss.str()); } break; } - case STRING_RESULT: - { - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - { } - else - { - SRCP srcp(buildReturnedColumn(item, gwi, gwi.fatalParseError)); - gwi.returnedCols.push_back(srcp); - - if (item->name.length) - srcp->alias(item->name.str); - - Item_string* isp = reinterpret_cast(item); - String val, *str = isp->val_str(&val); - string valStr; - valStr.assign(str->ptr(), str->length()); - string name = "'" + valStr + "'" + " " + "`" + escapeBackTick(srcp->alias().c_str()) + "`"; - - gwi.selectCols.push_back(name); - } - - break; - } - - case DECIMAL_RESULT: - { - if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI )) - { } - else - { - SRCP srcp(buildReturnedColumn(item, gwi, gwi.fatalParseError)); - gwi.returnedCols.push_back(srcp); - - if (item->name.length) - srcp->alias(item->name.str); - - Item_decimal* isp = reinterpret_cast(item); - String val, *str = isp->val_str(&val); - string valStr; - valStr.assign(str->ptr(), str->length()); - ostringstream oss; - oss << valStr.c_str() << " `" << escapeBackTick(srcp->alias().c_str()) << "`"; - - gwi.selectCols.push_back(oss.str()); - } - - break; - } + // MCOL-2178 This switch doesn't handl + // ROW_ default: - // WIP MCOL-2178 Same thing as for getSelectPlan { - // noop + IDEBUG(cerr << "Warning unsupported cmp_type() in projection" << endl); } } break; @@ -8972,25 +8752,16 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro case Item::NULL_ITEM: { - // WIP MCOL-2178 Check for NULL in projection. - /*if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI ) ) + if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) || ((gwi.thd->lex)->sql_command == SQLCOM_DELETE_MULTI ) ) { } else { SRCP srcp(buildReturnedColumn(item, gwi, gwi.fatalParseError)); gwi.returnedCols.push_back(srcp); - if (item->name) - srcp->alias(item->name); - - string name = string("null `") + escapeBackTick(srcp->alias().c_str()) + string("`") ; - - if (sel_cols_in_create.length() != 0) - sel_cols_in_create += ", "; - - sel_cols_in_create += name; - gwi.selectCols.push_back("null"); - }*/ + if (item->name.length) + srcp->alias(item->name.str); + } break; } @@ -9047,14 +8818,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro gwi.returnedCols.push_back(SRCP(rc)); - if (sub->name.length) - { - gwi.selectCols.push_back(sub->name.str); - } - else - { - } - break; } @@ -9764,9 +9527,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro if (!isUnion && !gwi.hasWindowFunc && gwi.subSelectType == CalpontSelectExecutionPlan::MAIN_SELECT) { - std::ostringstream vtb; - vtb << "infinidb_vtable.$vtable_" << gwi.thd->thread_id; - // re-construct the select query and redo phase 1 if (redo) { diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 36f152578..14aa1d61d 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -764,7 +764,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h // bug 3483, reserve enough space for the longest double value // -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and // 2.2250738585072014E-308 to 1.7976931348623157E+308. - (*f)->field_length = 40; + (*f)->field_length = 310; f2->store(dl); @@ -1340,16 +1340,13 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi) else schemaName = string(item->db_name); + columnAssignmentPtr = new ColumnAssignment(item->name.str, "=", ""); if (item->field_type() == MYSQL_TYPE_TIMESTAMP || item->field_type() == MYSQL_TYPE_TIMESTAMP2) { timeStampColumnNames.insert(string(item->name.str)); } - columnAssignmentPtr = new ColumnAssignment(); - columnAssignmentPtr->fColumn = string(item->name.str); - columnAssignmentPtr->fOperator = "="; - columnAssignmentPtr->fFuncScale = 0; Item* value = value_it++; if (value->type() == Item::CONST_ITEM) @@ -1468,8 +1465,9 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi) else if ( value->type() == Item::NULL_ITEM ) { // dmlStmt += "NULL"; - columnAssignmentPtr->fScalarExpression = "NULL"; + columnAssignmentPtr->fScalarExpression = ""; columnAssignmentPtr->fFromCol = false; + columnAssignmentPtr->fIsNull = true; } else if ( value->type() == Item::SUBSELECT_ITEM ) { @@ -1535,11 +1533,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi) { if (timeStampColumnNames.find(onUpdateTimeStampColumns[i]) == timeStampColumnNames.end()) { - columnAssignmentPtr = new ColumnAssignment(); - columnAssignmentPtr->fColumn = string(onUpdateTimeStampColumns[i]); - columnAssignmentPtr->fOperator = "="; - columnAssignmentPtr->fFuncScale = 0; - columnAssignmentPtr->fFromCol = false; + columnAssignmentPtr = new ColumnAssignment(string(onUpdateTimeStampColumns[i]), "=", ""); struct timeval tv; char buf[64]; gettimeofday(&tv, 0); @@ -2262,26 +2256,6 @@ int ha_calpont_impl_discover_existence(const char* schema, const char* name) int ha_calpont_impl_rnd_init(TABLE* table) { -#ifdef DEBUG_SETENV - string home(getenv("HOME")); - - if (!getenv("COLUMNSTORE_HOME")) - { - string calpontHome(home + "/Calpont/etc/"); - setenv("COLUMNSTORE_HOME", calpontHome.c_str(), 1); - } - - if (!getenv("COLUMNSTORE_CONFIG_FILE")) - { - string calpontConfigFile(home + "/mariadb/columnstore/etc/Columnstore.xml"); - setenv("COLUMNSTORE_CONFIG_FILE", calpontConfigFile.c_str(), 1); - } - - if (!getenv("CALPONT_CSC_IDENT")) - setenv("CALPONT_CSC_IDENT", "dm", 1); - -#endif - IDEBUG( cout << "rnd_init for table " << table->s->table_name.str << endl ); THD* thd = current_thd; @@ -2664,9 +2638,9 @@ int ha_calpont_impl_rnd_next(uchar* buf, TABLE* table) return HA_ERR_END_OF_FILE; // @bug 2547 -// TODO MCOL-2178 This variable can never be true in the scope of this function -// if (MIGR::infinidb_vtable.impossibleWhereOnUnion) -// return HA_ERR_END_OF_FILE; + // MCOL-2178 This variable can never be true in the scope of this function + // if (MIGR::infinidb_vtable.impossibleWhereOnUnion) + // return HA_ERR_END_OF_FILE; if (get_fe_conn_info_ptr() == NULL) set_fe_conn_info_ptr((void*)new cal_connection_info()); @@ -2756,13 +2730,11 @@ int ha_calpont_impl_rnd_end(TABLE* table, bool is_pushdown_hand) return 0; - // WIP MCOL-2178 - // Workaround because CS doesn't reset isUnion in a normal way. -// TODO MCOL-2178 isUnion member only assigned, never used -// if (is_pushdown_hand) -// { -// MIGR::infinidb_vtable.isUnion = false; -// } + // MCOL-2178 isUnion member only assigned, never used + // if (is_pushdown_hand) + // { + // MIGR::infinidb_vtable.isUnion = false; + // } if (get_fe_conn_info_ptr() != NULL) ci = reinterpret_cast(get_fe_conn_info_ptr()); @@ -2891,10 +2863,6 @@ int ha_calpont_impl_create(const char* name, TABLE* table_arg, HA_CREATE_INFO* c cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); - // @bug1940 Do nothing for select query. Support of set default engine to IDB. - if (string(name).find("@0024vtable") != string::npos) - return 0; - //@Bug 1948. Mysql calls create table to create a new table with new signature. if (ci->alterTableState > 0) return 0; @@ -2930,10 +2898,6 @@ int ha_calpont_impl_delete_table(const char* name) //if this is an InfiniDB tmp table ('#sql*.frm') just leave... if (!memcmp((uchar*)name, tmp_file_prefix, tmp_file_prefix_length)) return 0; - // @bug1940 Do nothing for select query. Support of set default engine to IDB. - if (string(name).find("@0024vtable") != string::npos) - return 0; - if (get_fe_conn_info_ptr() == NULL) set_fe_conn_info_ptr((void*)new cal_connection_info()); @@ -2970,22 +2934,6 @@ int ha_calpont_impl_delete_table(const char* name) return 0; } - // @bug 1793. make vtable droppable in calpontsys. "$vtable" ==> "@0024vtable" passed in as name. - if (strcmp(dbName, "calpontsys") == 0 && string(name).find("@0024vtable") == string::npos) - { - std::string stmt(idb_mysql_query_str(thd)); - boost::algorithm::to_upper(stmt); - - //@Bug 2432. systables can be dropped with restrict - if (stmt.find(" RESTRICT") != string::npos) - { - return 0; - } - - setError(thd, ER_INTERNAL_ERROR, "Calpont system tables can only be dropped with restrict."); - return 1; - } - int rc = ha_calpont_impl_delete_table_(dbName, name, *ci); return rc; } @@ -4355,17 +4303,16 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE // send plan whenever group_init is called int status = cp_get_group_plan(thd, csep, gi); - // WIP MCOL-2178 This could be a problem - if (status > 0) + // Never proceed if status != 0 to avoid empty DA + // crashes on later stages + if (status != 0) goto internal_error; - else if (status < 0) - return 0; // @bug 2547. don't need to send the plan if it's impossible where for all unions. -// TODO MCOL-2178 commenting the below out since cp_get_group_plan does not modify this variable -// which has a default value of false -// if (MIGR::infinidb_vtable.impossibleWhereOnUnion) -// return 0; + // MCOL-2178 commenting the below out since cp_get_group_plan does not modify this variable + // which has a default value of false + //if (MIGR::infinidb_vtable.impossibleWhereOnUnion) + // return 0; string query; // Set the query text only once if the server executes @@ -4632,9 +4579,9 @@ int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE return HA_ERR_END_OF_FILE; // @bug 2547 -// TODO MCOL-2178 -// if (MIGR::infinidb_vtable.impossibleWhereOnUnion) -// return HA_ERR_END_OF_FILE; + // MCOL-2178 + // if (MIGR::infinidb_vtable.impossibleWhereOnUnion) + // return HA_ERR_END_OF_FILE; if (get_fe_conn_info_ptr() == NULL) set_fe_conn_info_ptr((void*)new cal_connection_info()); @@ -4728,8 +4675,8 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE* thd->lex->sql_command == SQLCOM_LOAD)) return 0; -// TODO MCOL-2178 isUnion member only assigned, never used -// MIGR::infinidb_vtable.isUnion = false; + // MCOL-2178 isUnion member only assigned, never used + // MIGR::infinidb_vtable.isUnion = false; if (get_fe_conn_info_ptr() != NULL) ci = reinterpret_cast(get_fe_conn_info_ptr()); @@ -4894,26 +4841,6 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE* ***********************************************************/ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table) { -#ifdef DEBUG_SETENV - string home(getenv("HOME")); - - if (!getenv("CALPONT_HOME")) - { - string calpontHome(home + "/Calpont/etc/"); - setenv("CALPONT_HOME", calpontHome.c_str(), 1); - } - - if (!getenv("CALPONT_CONFIG_FILE")) - { - string calpontConfigFile(home + "/Calpont/etc/Columnstore.xml"); - setenv("CALPONT_CONFIG_FILE", calpontConfigFile.c_str(), 1); - } - - if (!getenv("CALPONT_CSC_IDENT")) - setenv("CALPONT_CSC_IDENT", "dm", 1); - -#endif - IDEBUG( cout << "pushdown_init for table " << endl ); THD* thd = current_thd; @@ -5052,8 +4979,7 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table) hndl = ci->cal_conn_hndl; - // WIP MCOL-2178 - std::cout << idb_mysql_query_str(thd) << std::endl; + IDEBUG( std::cout << idb_mysql_query_str(thd) << std::endl ); { if (!csep) @@ -5094,15 +5020,10 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table) status = cs_get_derived_plan(dh, thd, csep, gwi); } - // WIP MCOL-2178 Remove this - std::cout << "pushdown_init get_plan status " << status << std::endl; - // Return an error to avoid MDB crash later in end_statement if (status != 0) goto internal_error; - // WIP MCOL-2178 Remove this - std::cout << "pushdown_init impossibleWhereOnUnion " << status << std::endl; // @bug 2547. don't need to send the plan if it's impossible where for all unions. if (gwi.cs_vtable_impossible_where_on_union) { @@ -5123,6 +5044,7 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, msg.c_str()); } +// DRRTUY Make this runtime configureable #ifdef PLAN_HEX_FILE // plan serialization ifstream ifs("/tmp/li1-plan.hex"); diff --git a/dbcon/mysql/ha_calpont_impl.h b/dbcon/mysql/ha_calpont_impl.h index 7e8de5ce5..7a92f7646 100644 --- a/dbcon/mysql/ha_calpont_impl.h +++ b/dbcon/mysql/ha_calpont_impl.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_calpont_impl_if.h b/dbcon/mysql/ha_calpont_impl_if.h index 791aa999b..ed467527b 100644 --- a/dbcon/mysql/ha_calpont_impl_if.h +++ b/dbcon/mysql/ha_calpont_impl_if.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -94,6 +94,7 @@ typedef std::map selectCols; execplan::CalpontSelectExecutionPlan::ReturnedColumnList returnedCols; execplan::CalpontSelectExecutionPlan::ReturnedColumnList groupByCols; diff --git a/dbcon/mysql/ha_calpont_partition.cpp b/dbcon/mysql/ha_calpont_partition.cpp index 5ee2311d0..5cd957675 100644 --- a/dbcon/mysql/ha_calpont_partition.cpp +++ b/dbcon/mysql/ha_calpont_partition.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_calpont_udf.cpp b/dbcon/mysql/ha_calpont_udf.cpp index 1e6f20301..3c5b8dd41 100644 --- a/dbcon/mysql/ha_calpont_udf.cpp +++ b/dbcon/mysql/ha_calpont_udf.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_exists_sub.cpp b/dbcon/mysql/ha_exists_sub.cpp index eb6bc84b8..ee3326803 100644 --- a/dbcon/mysql/ha_exists_sub.cpp +++ b/dbcon/mysql/ha_exists_sub.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_from_sub.cpp b/dbcon/mysql/ha_from_sub.cpp index 2c2a12ec5..0093330aa 100644 --- a/dbcon/mysql/ha_from_sub.cpp +++ b/dbcon/mysql/ha_from_sub.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -347,6 +347,7 @@ SCSEP FromSubQuery::transform() gwi.subQuery = this; gwi.viewName = fGwip.viewName; csep->derivedTbAlias(fAlias); // always lower case + csep->derivedTbView(fGwip.viewName.alias); if (getSelectPlan(gwi, *fFromSub, csep, fPushdownHand) != 0) { diff --git a/dbcon/mysql/ha_in_sub.cpp b/dbcon/mysql/ha_in_sub.cpp index 3f257961a..a582ea5bf 100644 --- a/dbcon/mysql/ha_in_sub.cpp +++ b/dbcon/mysql/ha_in_sub.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_mcs_client_udfs.cpp b/dbcon/mysql/ha_mcs_client_udfs.cpp index 9113ae51b..6f6436101 100644 --- a/dbcon/mysql/ha_mcs_client_udfs.cpp +++ b/dbcon/mysql/ha_mcs_client_udfs.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_mcs_pushdown.cpp b/dbcon/mysql/ha_mcs_pushdown.cpp index 1b2981b84..ab8966290 100644 --- a/dbcon/mysql/ha_mcs_pushdown.cpp +++ b/dbcon/mysql/ha_mcs_pushdown.cpp @@ -149,17 +149,17 @@ create_calpont_group_by_handler(THD* thd, Query* query) { ha_calpont_group_by_handler* handler = NULL; + // same as thd->lex->current_select + SELECT_LEX *select_lex = query->from->select_lex; + // MCOL-2178 Disable SP support in the group_by_handler for now // Check the session variable value to enable/disable use of - // group_by_handler - if (!get_group_by_handler(thd) || (thd->lex)->sphead) + // group_by_handler. There is no GBH if SH works for the query. + if (select_lex->select_h || !get_group_by_handler(thd) || (thd->lex)->sphead) { return handler; } - // same as thd->lex->current_select - SELECT_LEX *select_lex = query->from->select_lex; - // Create a handler if query is valid. See comments for details. if ( query->group_by || select_lex->with_sum_func ) { @@ -172,7 +172,7 @@ create_calpont_group_by_handler(THD* thd, Query* query) unsupported_feature = select_lex->is_correlated; // Impossible HAVING or WHERE - if ( ( !unsupported_feature && query->having && select_lex->having_value == Item::COND_FALSE ) + if ( ( !unsupported_feature && select_lex->having_value == Item::COND_FALSE ) || ( select_lex->cond_count > 0 && select_lex->cond_value == Item::COND_FALSE ) ) { @@ -473,11 +473,10 @@ create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex) } // Impossible HAVING or WHERE - // WIP replace with function call + // TODO replace with function call if ( unsupported_feature - || ( select_lex->having && select_lex->having_value == Item::COND_FALSE ) - || ( select_lex->cond_count > 0 - && select_lex->cond_value == Item::COND_FALSE ) ) + || select_lex->having_value == Item::COND_FALSE + || select_lex->cond_value == Item::COND_FALSE ) { unsupported_feature = true; } diff --git a/dbcon/mysql/ha_mcs_sysvars.cpp b/dbcon/mysql/ha_mcs_sysvars.cpp index 438075eb5..b0fc0bb0b 100644 --- a/dbcon/mysql/ha_mcs_sysvars.cpp +++ b/dbcon/mysql/ha_mcs_sysvars.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_mcs_sysvars.h b/dbcon/mysql/ha_mcs_sysvars.h index a977842bc..38ed294cf 100644 --- a/dbcon/mysql/ha_mcs_sysvars.h +++ b/dbcon/mysql/ha_mcs_sysvars.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_scalar_sub.cpp b/dbcon/mysql/ha_scalar_sub.cpp index 8669303f9..debd777f0 100644 --- a/dbcon/mysql/ha_scalar_sub.cpp +++ b/dbcon/mysql/ha_scalar_sub.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_select_sub.cpp b/dbcon/mysql/ha_select_sub.cpp index 54124b0f9..0b003b664 100644 --- a/dbcon/mysql/ha_select_sub.cpp +++ b/dbcon/mysql/ha_select_sub.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_subquery.h b/dbcon/mysql/ha_subquery.h index b201e2fe3..d5e1df5a4 100644 --- a/dbcon/mysql/ha_subquery.h +++ b/dbcon/mysql/ha_subquery.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_view.cpp b/dbcon/mysql/ha_view.cpp index 6553a0e44..65707e4c7 100644 --- a/dbcon/mysql/ha_view.cpp +++ b/dbcon/mysql/ha_view.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/ha_window_function.cpp b/dbcon/mysql/ha_window_function.cpp index eb02b77a3..6a8117707 100644 --- a/dbcon/mysql/ha_window_function.cpp +++ b/dbcon/mysql/ha_window_function.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/dbcon/mysql/is_columnstore_columns.cpp b/dbcon/mysql/is_columnstore_columns.cpp index 278a606d4..66d97564c 100644 --- a/dbcon/mysql/is_columnstore_columns.cpp +++ b/dbcon/mysql/is_columnstore_columns.cpp @@ -2,7 +2,7 @@ * vi: set shiftwidth=4 tabstop=4 expandtab: * :indentSize=4:tabSize=4:noTabs=true: * - * Copyright (C) 2016 MariaDB Corporaton + * Copyright (C) 2016 MariaDB Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -276,7 +276,7 @@ maria_declare_plugin(is_columnstore_columns_plugin) MYSQL_INFORMATION_SCHEMA_PLUGIN, &is_columnstore_columns_plugin_version, "COLUMNSTORE_COLUMNS", - "MariaDB Corporaton", + "MariaDB Corporation", "An information schema plugin to list ColumnStore columns", PLUGIN_LICENSE_GPL, is_columnstore_columns_plugin_init, diff --git a/dbcon/mysql/is_columnstore_extents.cpp b/dbcon/mysql/is_columnstore_extents.cpp index bdde53316..99aa43eba 100644 --- a/dbcon/mysql/is_columnstore_extents.cpp +++ b/dbcon/mysql/is_columnstore_extents.cpp @@ -2,7 +2,7 @@ * vi: set shiftwidth=4 tabstop=4 expandtab: * :indentSize=4:tabSize=4:noTabs=true: * - * Copyright (C) 2016 MariaDB Corporaton + * Copyright (C) 2016 MariaDB Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -294,7 +294,7 @@ maria_declare_plugin(is_columnstore_extents_plugin) MYSQL_INFORMATION_SCHEMA_PLUGIN, &is_columnstore_extents_plugin_version, "COLUMNSTORE_EXTENTS", - "MariaDB Corporaton", + "MariaDB Corporation", "An information schema plugin to list ColumnStore extents", PLUGIN_LICENSE_GPL, is_columnstore_extents_plugin_init, diff --git a/dbcon/mysql/is_columnstore_files.cpp b/dbcon/mysql/is_columnstore_files.cpp index 9bca1de21..378985303 100644 --- a/dbcon/mysql/is_columnstore_files.cpp +++ b/dbcon/mysql/is_columnstore_files.cpp @@ -2,7 +2,7 @@ * vi: set shiftwidth=4 tabstop=4 expandtab: * :indentSize=4:tabSize=4:noTabs=true: * - * Copyright (C) 2016 MariaDB Corporaton + * Copyright (C) 2016 MariaDB Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -305,7 +305,7 @@ maria_declare_plugin(is_columnstore_files_plugin) MYSQL_INFORMATION_SCHEMA_PLUGIN, &is_columnstore_files_plugin_version, "COLUMNSTORE_FILES", - "MariaDB Corporaton", + "MariaDB Corporation", "An information schema plugin to list ColumnStore filess", PLUGIN_LICENSE_GPL, is_columnstore_files_plugin_init, diff --git a/dbcon/mysql/is_columnstore_tables.cpp b/dbcon/mysql/is_columnstore_tables.cpp index 02a5dd72e..1f66308f7 100644 --- a/dbcon/mysql/is_columnstore_tables.cpp +++ b/dbcon/mysql/is_columnstore_tables.cpp @@ -2,7 +2,7 @@ * vi: set shiftwidth=4 tabstop=4 expandtab: * :indentSize=4:tabSize=4:noTabs=true: * - * Copyright (C) 2016 MariaDB Corporaton + * Copyright (C) 2016 MariaDB Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -174,7 +174,7 @@ maria_declare_plugin(is_columnstore_tables_plugin) MYSQL_INFORMATION_SCHEMA_PLUGIN, &is_columnstore_tables_plugin_version, "COLUMNSTORE_TABLES", - "MariaDB Corporaton", + "MariaDB Corporation", "An information schema plugin to list ColumnStore tables", PLUGIN_LICENSE_GPL, is_columnstore_tables_plugin_init, diff --git a/dmlproc/dmlproc.cpp b/dmlproc/dmlproc.cpp index a3e6fa713..09e5b9128 100644 --- a/dmlproc/dmlproc.cpp +++ b/dmlproc/dmlproc.cpp @@ -86,6 +86,8 @@ using namespace joblist; namespace fs = boost::filesystem; +threadpool::ThreadPool DMLServer::fDmlPackagepool(10, 0); + namespace { DistributedEngineComm* Dec; @@ -605,7 +607,7 @@ int main(int argc, char* argv[]) int temp; int serverThreads = 10; - int serverQueueSize = 50; + int serverQueueSize = 0; const string DMLProc("DMLProc"); temp = toInt(cf->getConfig(DMLProc, "ServerThreads")); @@ -613,10 +615,9 @@ int main(int argc, char* argv[]) if (temp > 0) serverThreads = temp; - temp = toInt(cf->getConfig(DMLProc, "ServerQueueSize")); - - if (temp > 0) - serverQueueSize = temp; +// temp = toInt(cf->getConfig(DMLProc, "ServerQueueSize")); +// if (temp > 0) +// serverQueueSize = temp; //read and cleanup port before trying to use try @@ -656,6 +657,8 @@ int main(int argc, char* argv[]) { JobStep::jobstepThreadPool.setDebug(true); JobStep::jobstepThreadPool.invoke(threadpool::ThreadPoolMonitor(&JobStep::jobstepThreadPool)); + DMLServer::fDmlPackagepool.setDebug(true); + DMLServer::fDmlPackagepool.invoke(threadpool::ThreadPoolMonitor(&DMLServer::fDmlPackagepool)); } //set ACTIVE state diff --git a/dmlproc/dmlprocessor.cpp b/dmlproc/dmlprocessor.cpp index 861198d45..9e1601a36 100644 --- a/dmlproc/dmlprocessor.cpp +++ b/dmlproc/dmlprocessor.cpp @@ -349,7 +349,7 @@ PackageHandler::~PackageHandler() // Rollback will most likely be next. // // A tranasaction for one fTableOid is not blocked by a txn for a different fTableOid. -int PackageHandler::synchTableAccess() +int PackageHandler::synchTableAccess(dmlpackage::CalpontDMLPackage* dmlPackage) { // MCOL-140 Wait for any other DML using this table. std::map::iterator it; @@ -393,10 +393,27 @@ int PackageHandler::synchTableAccess() // tableOidQueue here is the queue holding the waitng transactions for this fTableOid while (true) { + // Log something that we're waiting + LoggingID logid(21, fSessionID, fTxnid); + logging::Message::Args args1; + logging::Message msg(1); + ostringstream oss; + oss << "Txn is waiting for" << tableOidQueue.front() << " " << dmlPackage->get_SQLStatement() << "; |" << dmlPackage->get_SchemaName() <<"|"; + args1.add(oss.str()); + args1.add((uint64_t)fTableOid); + msg.format(args1); + logging::Logger logger(logid.fSubsysID); + logger.logMessage(LOG_TYPE_DEBUG, msg, logid); + tableOidCond.wait(lock); - + // In case of CTRL+C, the tableOidQueue could be invalidated + if ((tableOidMap.find(fTableOid))->second != tableOidQueue) + { + break; + } if (tableOidQueue.front() == fTxnid) { + // We're up next. Let's go do stuff. break; } @@ -439,7 +456,6 @@ int PackageHandler::releaseTableAccess() if (fTableOid == 0 || (it = tableOidMap.find(fTableOid)) == tableOidMap.end()) { - // This will happen for DML_COMMAND, as we never got the tableoid or called synchTableAccess return 2; // For now, return codes are not used } @@ -461,7 +477,8 @@ int PackageHandler::releaseTableAccess() } else { - tableOidQueue.pop(); // Get off the waiting list. + if (!tableOidQueue.empty()) + tableOidQueue.pop(); // Get off the waiting list. if (tableOidQueue.empty()) { @@ -477,7 +494,7 @@ int PackageHandler::releaseTableAccess() int PackageHandler::forceReleaseTableAccess() { - // By removing the tcnid from the queue, the logic after the wait in + // By removing the txnid from the queue, the logic after the wait in // synchTableAccess() will release the thread and clean up if needed. std::map::iterator it; boost::lock_guard lock(tableOidMutex); @@ -490,6 +507,11 @@ int PackageHandler::forceReleaseTableAccess() PackageHandler::tableAccessQueue_t& tableOidQueue = it->second; tableOidQueue.erase(fTxnid); + if (tableOidQueue.empty()) + { + // remove the queue from the map. + tableOidMap.erase(fTableOid); + } // release the condition tableOidCond.notify_all(); return 1; @@ -513,7 +535,8 @@ void PackageHandler::run() std::string stmt; unsigned DMLLoggingId = 21; oam::OamCache* oamCache = oam::OamCache::makeOamCache(); - + SynchTable synchTable; + try { switch ( fPackageType ) @@ -542,8 +565,7 @@ void PackageHandler::run() CalpontSystemCatalog::ROPair roPair = fcsc->tableRID(tableName); fTableOid = roPair.objnum; } - - synchTableAccess(); // Blocks if another DML thread is using this fTableOid + synchTable.setPackage(this, &insertPkg); // Blocks if another DML thread is using this fTableOid } #endif @@ -921,8 +943,7 @@ void PackageHandler::run() CalpontSystemCatalog::ROPair roPair = fcsc->tableRID(tableName); fTableOid = roPair.objnum; } - - synchTableAccess(); // Blocks if another DML thread is using this fTableOid + synchTable.setPackage(this, updatePkg.get()); // Blocks if another DML thread is using this fTableOid } #endif @@ -981,8 +1002,7 @@ void PackageHandler::run() CalpontSystemCatalog::ROPair roPair = fcsc->tableRID(tableName); fTableOid = roPair.objnum; } - - synchTableAccess(); // Blocks if another DML thread is using this fTableOid + synchTable.setPackage(this, deletePkg.get()); // Blocks if another DML thread is using this fTableOid } #endif @@ -1049,15 +1069,8 @@ void PackageHandler::run() break; } -#ifdef MCOL_140 - if (fConcurrentSupport) - { - // MCOL-140 We're done. release the next waiting txn for this fTableOid - releaseTableAccess(); - } -#endif //Log errors if ( (result.result != dmlpackageprocessor::DMLPackageProcessor::NO_ERROR) @@ -1080,15 +1093,8 @@ void PackageHandler::run() } catch (std::exception& e) { -#ifdef MCOL_140 - if (fConcurrentSupport) - { - // MCOL-140 We're done. release the next waiting txn for this fTableOid - releaseTableAccess(); - } -#endif cout << "dmlprocessor.cpp PackageHandler::run() package type(" << fPackageType << ") exception: " << e.what() << endl; logging::LoggingID lid(21); @@ -1105,15 +1111,8 @@ void PackageHandler::run() } catch (...) { -#ifdef MCOL_140 - if (fConcurrentSupport) - { - // MCOL-140 We're done. release the next waiting txn for this fTableOid - releaseTableAccess(); - } -#endif logging::LoggingID lid(21); logging::MessageLog ml(lid); logging::Message::Args args; @@ -1157,9 +1156,17 @@ void PackageHandler::run() void PackageHandler::rollbackPending() { + if (fProcessor.get() == NULL) + { + // This happens when batch insert + return; + } + + fProcessor->setRollbackPending(true); + // Force a release of the processing from MCOL-140 #ifdef MCOL_140 - if (fConcurrentSupport) + if (fConcurrentSupport) { // MCOL-140 We're not necessarily the next in line. // This forces this thread to be released anyway. @@ -1168,14 +1175,6 @@ void PackageHandler::rollbackPending() #endif - if (fProcessor.get() == NULL) - { - // This happens when batch insert - return; - } - - fProcessor->setRollbackPending(true); - ostringstream oss; oss << "PackageHandler::rollbackPending: Processing DMLPackage."; DMLProcessor::log(oss.str(), logging::LOG_TYPE_DEBUG); diff --git a/dmlproc/dmlprocessor.h b/dmlproc/dmlprocessor.h index 60ba8a14b..6a18493b1 100644 --- a/dmlproc/dmlprocessor.h +++ b/dmlproc/dmlprocessor.h @@ -151,15 +151,16 @@ private: DMLServer(const DMLServer& rhs); DMLServer& operator=(const DMLServer& rhs); - /** @brief the thread pool for processing dml packages - */ - threadpool::ThreadPool fDmlPackagepool; - int fPackageMaxThreads; /** @brief max number of threads to process dml packages */ int fPackageWorkQueueSize; /** @brief max number of packages waiting in the work queue */ boost::scoped_ptr fMqServer; BRM::DBRM* fDbrm; + +public: + /** @brief the thread pool for processing dml packages + */ + static threadpool::ThreadPool fDmlPackagepool; }; /** @brief Thread to process a single dml package. @@ -207,12 +208,12 @@ private: // Used to serialize operations because the VSS can't handle inserts // or updates on the same block. // When an Insert, Update or Delete command arrives, we look here - // for the table oid. If found, wait until it is no onger here. + // for the table oid. If found, wait until it is no longer here. // If this transactionID (SCN) is < the transactionID in the table, don't delay // and hope for the best, as we're already out of order. // When the VSS is engineered to handle transactions out of order, all MCOL-140 // code is to be removed. - int synchTableAccess(); + int synchTableAccess(dmlpackage::CalpontDMLPackage* dmlPackage); int releaseTableAccess(); int forceReleaseTableAccess(); typedef iterable_queue tableAccessQueue_t; @@ -221,6 +222,35 @@ private: static boost::mutex tableOidMutex; public: static int clearTableAccess(); + + // MCOL-3296 Add a class to call synchTableAccess on creation and + // releaseTableAccess on destuction for exception safeness. + class SynchTable + { + public: + SynchTable() : fphp(NULL) {}; + SynchTable(PackageHandler* php, dmlpackage::CalpontDMLPackage* dmlPackage) + { + setPackage(php, dmlPackage); + } + ~SynchTable() + { + if (fphp) + fphp->releaseTableAccess(); + } + bool setPackage(PackageHandler* php, dmlpackage::CalpontDMLPackage* dmlPackage) + { + if (fphp) + fphp->releaseTableAccess(); + fphp = php; + if (fphp) + fphp->synchTableAccess(dmlPackage); + return true; + } + private: + PackageHandler* fphp; + }; + }; /** @brief processes dml packages as they arrive diff --git a/exemgr/main.cpp b/exemgr/main.cpp index e66d7783e..4b43f71bc 100644 --- a/exemgr/main.cpp +++ b/exemgr/main.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 927250cfc..cf43aae8e 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h index 5d5a09c6c..04276081d 100644 --- a/oam/oamcpp/liboamcpp.h +++ b/oam/oamcpp/liboamcpp.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oam/oamcpp/oamcache.cpp b/oam/oamcpp/oamcache.cpp index d8035bbf3..b25a72938 100644 --- a/oam/oamcpp/oamcache.cpp +++ b/oam/oamcpp/oamcache.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oam/oamcpp/oamcache.h b/oam/oamcpp/oamcache.h index 1f64fbec8..013dcf85a 100644 --- a/oam/oamcpp/oamcache.h +++ b/oam/oamcpp/oamcache.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oam/replaytxnlog/replaytxnlog.cpp b/oam/replaytxnlog/replaytxnlog.cpp index 0a1cdc9cc..78f4617d7 100644 --- a/oam/replaytxnlog/replaytxnlog.cpp +++ b/oam/replaytxnlog/replaytxnlog.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/alarmmanager/alarmglobal.h b/oamapps/alarmmanager/alarmglobal.h index 343be54a7..554f71e5e 100644 --- a/oamapps/alarmmanager/alarmglobal.h +++ b/oamapps/alarmmanager/alarmglobal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2016 MariaDB Corporaton +/* Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index c0507aadd..67907ceb9 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -899,9 +899,9 @@ int processCommand(string* arguments) SendToWES(oam, bs); } #if _MSC_VER - if (_strnicmp(arguments[1].c_str(), "stop", 4) == 0)) + else if (_strnicmp(arguments[1].c_str(), "stop", 4) == 0)) #else - if (strncasecmp(arguments[1].c_str(), "stop", 4) == 0) + else if (strncasecmp(arguments[1].c_str(), "stop", 4) == 0) #endif { ByteStream bs; @@ -913,9 +913,9 @@ int processCommand(string* arguments) SendToWES(oam, bs); } #if _MSC_VER - if (_strnicmp(arguments[1].c_str(), "status", 6) == 0)) + else if (_strnicmp(arguments[1].c_str(), "status", 6) == 0)) #else - if (strncasecmp(arguments[1].c_str(), "status", 6) == 0) + else if (strncasecmp(arguments[1].c_str(), "status", 6) == 0) #endif { ByteStream bs; diff --git a/oamapps/mcsadmin/mcsadmin.h b/oamapps/mcsadmin/mcsadmin.h index 2843090b8..66fda95c8 100644 --- a/oamapps/mcsadmin/mcsadmin.h +++ b/oamapps/mcsadmin/mcsadmin.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/amazonInstaller.cpp b/oamapps/postConfigure/amazonInstaller.cpp index ac46261c5..a4988b966 100644 --- a/oamapps/postConfigure/amazonInstaller.cpp +++ b/oamapps/postConfigure/amazonInstaller.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/helpers.h b/oamapps/postConfigure/helpers.h index 8eb23bce0..ff5c6f82e 100644 --- a/oamapps/postConfigure/helpers.h +++ b/oamapps/postConfigure/helpers.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/installer.cpp b/oamapps/postConfigure/installer.cpp index a0395bb57..85c8a30fa 100644 --- a/oamapps/postConfigure/installer.cpp +++ b/oamapps/postConfigure/installer.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/mycnfUpgrade.cpp b/oamapps/postConfigure/mycnfUpgrade.cpp index 745da6179..53cb0ce3c 100644 --- a/oamapps/postConfigure/mycnfUpgrade.cpp +++ b/oamapps/postConfigure/mycnfUpgrade.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/patchInstaller.cpp b/oamapps/postConfigure/patchInstaller.cpp index 9f36658c7..dd6d9ed35 100644 --- a/oamapps/postConfigure/patchInstaller.cpp +++ b/oamapps/postConfigure/patchInstaller.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 90649a2bb..4a13d783c 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -5338,7 +5338,7 @@ bool storageSetup(bool amazonInstall) if ( (glusterInstalled == "y" && singleServerInstall != "1") && hadoopInstalled == "y" ) { - cout << "There are 5 options when configuring the storage: internal, external, DataRedundancy, or hdfs" << endl << endl; + cout << "There are 4 options when configuring the storage: internal, external, DataRedundancy, or hdfs" << endl << endl; prompt = "Select the type of Data Storage [1=internal, 2=external, 3=DataRedundancy, 4=hdfs] (" + storageType + ") > "; } diff --git a/oamapps/resourceMonitor/resourceMonitor.cpp b/oamapps/resourceMonitor/resourceMonitor.cpp index dcda9940d..054e86c4c 100644 --- a/oamapps/resourceMonitor/resourceMonitor.cpp +++ b/oamapps/resourceMonitor/resourceMonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/serverMonitor/cpuMonitor.cpp b/oamapps/serverMonitor/cpuMonitor.cpp index 1f1d6b3b3..3d0c53a5f 100644 --- a/oamapps/serverMonitor/cpuMonitor.cpp +++ b/oamapps/serverMonitor/cpuMonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/serverMonitor/dbhealthMonitor.cpp b/oamapps/serverMonitor/dbhealthMonitor.cpp index fc1899b1f..3863b4964 100644 --- a/oamapps/serverMonitor/dbhealthMonitor.cpp +++ b/oamapps/serverMonitor/dbhealthMonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/serverMonitor/diskMonitor.cpp b/oamapps/serverMonitor/diskMonitor.cpp index b86a4837b..90c99e56d 100644 --- a/oamapps/serverMonitor/diskMonitor.cpp +++ b/oamapps/serverMonitor/diskMonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -267,7 +267,7 @@ void diskMonitor() blksize = buf.f_bsize; blocks = buf.f_blocks; - freeblks = buf.f_bfree; + freeblks = buf.f_bavail; totalBlocks = blocks * blksize; free = freeblks * blksize; @@ -396,7 +396,7 @@ void diskMonitor() blksize = buf.f_bsize; blocks = buf.f_blocks; - freeblks = buf.f_bfree; + freeblks = buf.f_bavail; totalBlocks = blocks * blksize; free = freeblks * blksize; diff --git a/oamapps/serverMonitor/memoryMonitor.cpp b/oamapps/serverMonitor/memoryMonitor.cpp index b72d17e64..d96217d56 100644 --- a/oamapps/serverMonitor/memoryMonitor.cpp +++ b/oamapps/serverMonitor/memoryMonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/oamapps/serverMonitor/msgProcessor.cpp b/oamapps/serverMonitor/msgProcessor.cpp index 1c7b928ee..fe330547e 100644 --- a/oamapps/serverMonitor/msgProcessor.cpp +++ b/oamapps/serverMonitor/msgProcessor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/blockcache/blockrequestprocessor.cpp b/primitives/blockcache/blockrequestprocessor.cpp index 063d513f4..5463005ed 100644 --- a/primitives/blockcache/blockrequestprocessor.cpp +++ b/primitives/blockcache/blockrequestprocessor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/blockcache/filebuffermgr.cpp b/primitives/blockcache/filebuffermgr.cpp index 013ef7603..fa7071942 100644 --- a/primitives/blockcache/filebuffermgr.cpp +++ b/primitives/blockcache/filebuffermgr.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/blockcache/iomanager.cpp b/primitives/blockcache/iomanager.cpp index 2bf4526e5..716b0b69d 100644 --- a/primitives/blockcache/iomanager.cpp +++ b/primitives/blockcache/iomanager.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/blockcache/stats.cpp b/primitives/blockcache/stats.cpp index 2d31016b2..3e74f9ad4 100644 --- a/primitives/blockcache/stats.cpp +++ b/primitives/blockcache/stats.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index bd7c7b406..8a664bd16 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016, 2017 MariaDB Corporaton + Copyright (C) 2016, 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/primproc/bppseeder.cpp b/primitives/primproc/bppseeder.cpp index 4b94d0c5c..aca03af25 100644 --- a/primitives/primproc/bppseeder.cpp +++ b/primitives/primproc/bppseeder.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/primproc/dictstep.cpp b/primitives/primproc/dictstep.cpp index 47bfeac25..abd99ada3 100644 --- a/primitives/primproc/dictstep.cpp +++ b/primitives/primproc/dictstep.cpp @@ -30,7 +30,6 @@ #include #include -#include #include "bpp.h" #include "primitiveserver.h" @@ -94,7 +93,6 @@ void DictStep::createCommand(ByteStream& bs) for (uint32_t i = 0; i < filterCount; i++) { bs >> strTmp; - boost::trim_right_if(strTmp, boost::is_any_of(" ")); //cout << " " << strTmp << endl; eqFilter->insert(strTmp); } diff --git a/primitives/primproc/primitiveserver.cpp b/primitives/primproc/primitiveserver.cpp index 54f4b7fb6..f64e38a4a 100644 --- a/primitives/primproc/primitiveserver.cpp +++ b/primitives/primproc/primitiveserver.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -28,7 +28,6 @@ #include #include #include -#include //#define NDEBUG #include #include @@ -1778,7 +1777,6 @@ private: for (i = 0; i < count; i++) { *bs >> str; - boost::trim_right_if(str, boost::is_any_of(" ")); filter->insert(str); } diff --git a/primitives/primproc/primitiveserver.h b/primitives/primproc/primitiveserver.h index f212fd9fd..69f0afe11 100644 --- a/primitives/primproc/primitiveserver.h +++ b/primitives/primproc/primitiveserver.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index 79222f216..46d6cb03e 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/procmgr/main.cpp b/procmgr/main.cpp index 35f544a75..2edb4c411 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index f05a7dcbf..25c99e88d 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/procmgr/processmanager.h b/procmgr/processmanager.h index 8dc39a540..bb0766881 100644 --- a/procmgr/processmanager.h +++ b/procmgr/processmanager.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 48fe00e6b..b17a5fa56 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/tools/configMgt/autoConfigure.cpp b/tools/configMgt/autoConfigure.cpp index 10d7318ee..7e910904b 100644 --- a/tools/configMgt/autoConfigure.cpp +++ b/tools/configMgt/autoConfigure.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -360,7 +360,19 @@ int main(int argc, char* argv[]) exit(-1); } - //setup System Language + // WaitPeriod + try + { + string waitPeriod = sysConfigOld->getConfig(SystemSection, "WaitPeriod"); + if (waitPeriod.length() > 0) + { + sysConfigNew->setConfig(SystemSection, "WaitPeriod", waitPeriod); + } + } + catch (...) + { } + + //setup System Language string systemLang = "C"; try diff --git a/tools/configMgt/autoInstaller.cpp b/tools/configMgt/autoInstaller.cpp index 7dfb934e9..74f697af7 100644 --- a/tools/configMgt/autoInstaller.cpp +++ b/tools/configMgt/autoInstaller.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/tools/configMgt/configure.cpp b/tools/configMgt/configure.cpp index 22c4ea0c4..7c600c2bb 100644 --- a/tools/configMgt/configure.cpp +++ b/tools/configMgt/configure.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/common/crashtrace.cpp b/utils/common/crashtrace.cpp index 2b39ed07c..afa593d38 100644 --- a/utils/common/crashtrace.cpp +++ b/utils/common/crashtrace.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 MariaDB Corporaton +/* Copyright (C) 2018 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/common/crashtrace.h b/utils/common/crashtrace.h index 3b9cb4036..230640185 100644 --- a/utils/common/crashtrace.h +++ b/utils/common/crashtrace.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 MariaDB Corporaton +/* Copyright (C) 2018 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/common/nullvaluemanip.cpp b/utils/common/nullvaluemanip.cpp index 44ee2273a..3b4255dea 100644 --- a/utils/common/nullvaluemanip.cpp +++ b/utils/common/nullvaluemanip.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/common/threadnaming.cpp b/utils/common/threadnaming.cpp index 2f4dda91f..65498ab61 100644 --- a/utils/common/threadnaming.cpp +++ b/utils/common/threadnaming.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 MariaDB Corporaton +/* Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/common/threadnaming.h b/utils/common/threadnaming.h index 1682b7045..4cdf28d20 100644 --- a/utils/common/threadnaming.h +++ b/utils/common/threadnaming.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 MariaDB Corporaton +/* Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/dataconvert/dataconvert.cpp b/utils/dataconvert/dataconvert.cpp index ff40952a0..d9b0543e6 100644 --- a/utils/dataconvert/dataconvert.cpp +++ b/utils/dataconvert/dataconvert.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_abs.cpp b/utils/funcexp/func_abs.cpp index 4cef9a791..7b04408ba 100644 --- a/utils/funcexp/func_abs.cpp +++ b/utils/funcexp/func_abs.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_between.cpp b/utils/funcexp/func_between.cpp index 44908ad4b..8330c4fc0 100644 --- a/utils/funcexp/func_between.cpp +++ b/utils/funcexp/func_between.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_case.cpp b/utils/funcexp/func_case.cpp index 22705cdd0..5c429a669 100644 --- a/utils/funcexp/func_case.cpp +++ b/utils/funcexp/func_case.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_cast.cpp b/utils/funcexp/func_cast.cpp index 27284d392..18a9b19aa 100644 --- a/utils/funcexp/func_cast.cpp +++ b/utils/funcexp/func_cast.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_ceil.cpp b/utils/funcexp/func_ceil.cpp index cd76df3e3..b1f886166 100644 --- a/utils/funcexp/func_ceil.cpp +++ b/utils/funcexp/func_ceil.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_coalesce.cpp b/utils/funcexp/func_coalesce.cpp index 4c3faca85..1f46a15b3 100644 --- a/utils/funcexp/func_coalesce.cpp +++ b/utils/funcexp/func_coalesce.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_exp.cpp b/utils/funcexp/func_exp.cpp index 6decbe652..217102daf 100644 --- a/utils/funcexp/func_exp.cpp +++ b/utils/funcexp/func_exp.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_floor.cpp b/utils/funcexp/func_floor.cpp index 2ec854b8c..50dd3d919 100644 --- a/utils/funcexp/func_floor.cpp +++ b/utils/funcexp/func_floor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_from_unixtime.cpp b/utils/funcexp/func_from_unixtime.cpp index 18dba41c8..8f5f3d051 100644 --- a/utils/funcexp/func_from_unixtime.cpp +++ b/utils/funcexp/func_from_unixtime.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_greatest.cpp b/utils/funcexp/func_greatest.cpp index 388a35f20..e064eacb3 100644 --- a/utils/funcexp/func_greatest.cpp +++ b/utils/funcexp/func_greatest.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_hex.cpp b/utils/funcexp/func_hex.cpp index 7f7c7eff9..42e6b04d2 100644 --- a/utils/funcexp/func_hex.cpp +++ b/utils/funcexp/func_hex.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_if.cpp b/utils/funcexp/func_if.cpp index cc46f4a27..b17ad7317 100644 --- a/utils/funcexp/func_if.cpp +++ b/utils/funcexp/func_if.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_ifnull.cpp b/utils/funcexp/func_ifnull.cpp index 6309171fd..e479ba69c 100644 --- a/utils/funcexp/func_ifnull.cpp +++ b/utils/funcexp/func_ifnull.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_in.cpp b/utils/funcexp/func_in.cpp index 5b1aa015c..ab691ed1f 100644 --- a/utils/funcexp/func_in.cpp +++ b/utils/funcexp/func_in.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_isnull.cpp b/utils/funcexp/func_isnull.cpp index ebe1c2d88..ffda2415d 100644 --- a/utils/funcexp/func_isnull.cpp +++ b/utils/funcexp/func_isnull.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_least.cpp b/utils/funcexp/func_least.cpp index 3675e940d..5f97ee892 100644 --- a/utils/funcexp/func_least.cpp +++ b/utils/funcexp/func_least.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_math.cpp b/utils/funcexp/func_math.cpp index ff4d908da..6ef3868c2 100644 --- a/utils/funcexp/func_math.cpp +++ b/utils/funcexp/func_math.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_mod.cpp b/utils/funcexp/func_mod.cpp index 4cbdf23af..23e4df008 100644 --- a/utils/funcexp/func_mod.cpp +++ b/utils/funcexp/func_mod.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_nullif.cpp b/utils/funcexp/func_nullif.cpp index 224c2d435..a81b439dc 100644 --- a/utils/funcexp/func_nullif.cpp +++ b/utils/funcexp/func_nullif.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_pow.cpp b/utils/funcexp/func_pow.cpp index f94432b6d..4e07c8410 100644 --- a/utils/funcexp/func_pow.cpp +++ b/utils/funcexp/func_pow.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_round.cpp b/utils/funcexp/func_round.cpp index c57dda167..805f87e56 100644 --- a/utils/funcexp/func_round.cpp +++ b/utils/funcexp/func_round.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_substring_index.cpp b/utils/funcexp/func_substring_index.cpp index 04d4d9b12..a3b5c342e 100644 --- a/utils/funcexp/func_substring_index.cpp +++ b/utils/funcexp/func_substring_index.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/func_timediff.cpp b/utils/funcexp/func_timediff.cpp index 1254f2d1b..0e16e3a4f 100644 --- a/utils/funcexp/func_timediff.cpp +++ b/utils/funcexp/func_timediff.cpp @@ -118,7 +118,10 @@ string Func_timediff::getStrVal(rowgroup::Row& row, case execplan::CalpontSystemCatalog::TIME: case execplan::CalpontSystemCatalog::DATETIME: - if (type1 != type2) + // Diff between time and datetime returns NULL in MariaDB + if ((type2 == execplan::CalpontSystemCatalog::TIME || + type2 == execplan::CalpontSystemCatalog::DATETIME) && + type1 != type2) { isNull = true; break; diff --git a/utils/funcexp/func_truncate.cpp b/utils/funcexp/func_truncate.cpp index a2f73753a..441047f74 100644 --- a/utils/funcexp/func_truncate.cpp +++ b/utils/funcexp/func_truncate.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/funcexp.cpp b/utils/funcexp/funcexp.cpp index c119dc549..e92bbcbcc 100644 --- a/utils/funcexp/funcexp.cpp +++ b/utils/funcexp/funcexp.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/funchelpers.h b/utils/funcexp/funchelpers.h index e1290d230..e579ebb57 100644 --- a/utils/funcexp/funchelpers.h +++ b/utils/funcexp/funchelpers.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor.cpp b/utils/funcexp/functor.cpp index 28fd64cbe..06999c9fd 100644 --- a/utils/funcexp/functor.cpp +++ b/utils/funcexp/functor.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor.h b/utils/funcexp/functor.h index 8eb494313..357d8639d 100644 --- a/utils/funcexp/functor.h +++ b/utils/funcexp/functor.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_all.h b/utils/funcexp/functor_all.h index a1daa0687..155e00656 100644 --- a/utils/funcexp/functor_all.h +++ b/utils/funcexp/functor_all.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_dtm.h b/utils/funcexp/functor_dtm.h index fddd0a002..f9b61ee80 100644 --- a/utils/funcexp/functor_dtm.h +++ b/utils/funcexp/functor_dtm.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_export.h b/utils/funcexp/functor_export.h index af7ca6cee..3d7405cc2 100644 --- a/utils/funcexp/functor_export.h +++ b/utils/funcexp/functor_export.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_int.h b/utils/funcexp/functor_int.h index e5b0093a9..78655a892 100644 --- a/utils/funcexp/functor_int.h +++ b/utils/funcexp/functor_int.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_real.h b/utils/funcexp/functor_real.h index a5ae4d317..717e2208e 100644 --- a/utils/funcexp/functor_real.h +++ b/utils/funcexp/functor_real.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/funcexp/functor_str.h b/utils/funcexp/functor_str.h index 2f772974a..24337aab9 100644 --- a/utils/funcexp/functor_str.h +++ b/utils/funcexp/functor_str.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/joiner/joinpartition.cpp b/utils/joiner/joinpartition.cpp index 4982ed750..e3b763120 100644 --- a/utils/joiner/joinpartition.cpp +++ b/utils/joiner/joinpartition.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/joiner/tuplejoiner.cpp b/utils/joiner/tuplejoiner.cpp index ff64b8283..f8ac47b98 100644 --- a/utils/joiner/tuplejoiner.cpp +++ b/utils/joiner/tuplejoiner.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/joiner/tuplejoiner.h b/utils/joiner/tuplejoiner.h index 7302876e0..83d68dfca 100644 --- a/utils/joiner/tuplejoiner.h +++ b/utils/joiner/tuplejoiner.h @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/loggingcpp/messagelog.cpp b/utils/loggingcpp/messagelog.cpp index a1dd850e2..6ddda51dd 100644 --- a/utils/loggingcpp/messagelog.cpp +++ b/utils/loggingcpp/messagelog.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/loggingcpp/tdriver.cpp b/utils/loggingcpp/tdriver.cpp index 16b98c5da..3e1342afa 100644 --- a/utils/loggingcpp/tdriver.cpp +++ b/utils/loggingcpp/tdriver.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/messageqcpp/bytestream.cpp b/utils/messageqcpp/bytestream.cpp index 003c35fd4..6ecbf625d 100644 --- a/utils/messageqcpp/bytestream.cpp +++ b/utils/messageqcpp/bytestream.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/messageqcpp/bytestream.h b/utils/messageqcpp/bytestream.h index cf3eb2057..7e39abc31 100644 --- a/utils/messageqcpp/bytestream.h +++ b/utils/messageqcpp/bytestream.h @@ -1,6 +1,6 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2019 MariaDB Corporaton + Copyright (C) 2019 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/messageqcpp/messagequeuepool.cpp b/utils/messageqcpp/messagequeuepool.cpp index f986f734f..f3cbcb2bc 100644 --- a/utils/messageqcpp/messagequeuepool.cpp +++ b/utils/messageqcpp/messagequeuepool.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/messageqcpp/messagequeuepool.h b/utils/messageqcpp/messagequeuepool.h index db49d8e5c..553328e7b 100644 --- a/utils/messageqcpp/messagequeuepool.h +++ b/utils/messageqcpp/messagequeuepool.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/corr.cpp b/utils/regr/corr.cpp index ac69357df..ac8c090bf 100644 --- a/utils/regr/corr.cpp +++ b/utils/regr/corr.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/corr.h b/utils/regr/corr.h index 389b61195..850690da4 100644 --- a/utils/regr/corr.h +++ b/utils/regr/corr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/covar_pop.cpp b/utils/regr/covar_pop.cpp index 672da9d75..f3794f89e 100644 --- a/utils/regr/covar_pop.cpp +++ b/utils/regr/covar_pop.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/covar_pop.h b/utils/regr/covar_pop.h index c3f6dde4a..dd675c7fa 100644 --- a/utils/regr/covar_pop.h +++ b/utils/regr/covar_pop.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/covar_samp.cpp b/utils/regr/covar_samp.cpp index 81e9fc212..98fa99fe9 100644 --- a/utils/regr/covar_samp.cpp +++ b/utils/regr/covar_samp.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/covar_samp.h b/utils/regr/covar_samp.h index fe0352fe8..f1511a364 100644 --- a/utils/regr/covar_samp.h +++ b/utils/regr/covar_samp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_avgx.cpp b/utils/regr/regr_avgx.cpp index c27d075ad..bec098116 100644 --- a/utils/regr/regr_avgx.cpp +++ b/utils/regr/regr_avgx.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_avgx.h b/utils/regr/regr_avgx.h index e76ecf56c..58138eff3 100644 --- a/utils/regr/regr_avgx.h +++ b/utils/regr/regr_avgx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_avgy.cpp b/utils/regr/regr_avgy.cpp index f22959354..512e3e48d 100644 --- a/utils/regr/regr_avgy.cpp +++ b/utils/regr/regr_avgy.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_avgy.h b/utils/regr/regr_avgy.h index 9e425a7bd..957becdd7 100644 --- a/utils/regr/regr_avgy.h +++ b/utils/regr/regr_avgy.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_count.cpp b/utils/regr/regr_count.cpp index 8b5993d33..7d893e16f 100644 --- a/utils/regr/regr_count.cpp +++ b/utils/regr/regr_count.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_count.h b/utils/regr/regr_count.h index 0fa140d56..b63a2d582 100644 --- a/utils/regr/regr_count.h +++ b/utils/regr/regr_count.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_intercept.cpp b/utils/regr/regr_intercept.cpp index 9b457243c..5e05eea19 100644 --- a/utils/regr/regr_intercept.cpp +++ b/utils/regr/regr_intercept.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_intercept.h b/utils/regr/regr_intercept.h index 50c7fbdd9..2ccd272f5 100644 --- a/utils/regr/regr_intercept.h +++ b/utils/regr/regr_intercept.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_r2.cpp b/utils/regr/regr_r2.cpp index 60bcad65c..2f28afe3e 100644 --- a/utils/regr/regr_r2.cpp +++ b/utils/regr/regr_r2.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_r2.h b/utils/regr/regr_r2.h index fac04eac8..26082d979 100644 --- a/utils/regr/regr_r2.h +++ b/utils/regr/regr_r2.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_slope.cpp b/utils/regr/regr_slope.cpp index 17e662f2c..2a3445da4 100644 --- a/utils/regr/regr_slope.cpp +++ b/utils/regr/regr_slope.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_slope.h b/utils/regr/regr_slope.h index d32223ae9..d14639cf1 100644 --- a/utils/regr/regr_slope.h +++ b/utils/regr/regr_slope.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_sxx.cpp b/utils/regr/regr_sxx.cpp index 2338d4436..0903148dc 100644 --- a/utils/regr/regr_sxx.cpp +++ b/utils/regr/regr_sxx.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_sxx.h b/utils/regr/regr_sxx.h index 82ec7e154..2f180483c 100644 --- a/utils/regr/regr_sxx.h +++ b/utils/regr/regr_sxx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_sxy.cpp b/utils/regr/regr_sxy.cpp index daef4333e..092d3c375 100644 --- a/utils/regr/regr_sxy.cpp +++ b/utils/regr/regr_sxy.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_sxy.h b/utils/regr/regr_sxy.h index 47e6c30e6..83517e113 100644 --- a/utils/regr/regr_sxy.h +++ b/utils/regr/regr_sxy.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_syy.cpp b/utils/regr/regr_syy.cpp index 6d803d992..0fc3102ed 100644 --- a/utils/regr/regr_syy.cpp +++ b/utils/regr/regr_syy.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/regr/regr_syy.h b/utils/regr/regr_syy.h index 26c8cc1e7..05d7e5f8f 100644 --- a/utils/regr/regr_syy.h +++ b/utils/regr/regr_syy.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index d496cbcb0..0990384cb 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -1771,7 +1771,8 @@ inline void copyRow(const Row& in, Row* out, uint32_t colCount) { if (UNLIKELY(in.getColTypes()[i] == execplan::CalpontSystemCatalog::VARBINARY || in.getColTypes()[i] == execplan::CalpontSystemCatalog::BLOB || - in.getColTypes()[i] == execplan::CalpontSystemCatalog::TEXT)) + in.getColTypes()[i] == execplan::CalpontSystemCatalog::TEXT || + in.getColTypes()[i] == execplan::CalpontSystemCatalog::CLOB)) out->setVarBinaryField(in.getVarBinaryStringField(i), i); else if (UNLIKELY(in.isLongString(i))) //out->setStringField(in.getStringField(i), i); diff --git a/utils/startup/installdir.cpp b/utils/startup/installdir.cpp index 5a15a651b..b49bbc743 100644 --- a/utils/startup/installdir.cpp +++ b/utils/startup/installdir.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/testbc/stats.cpp b/utils/testbc/stats.cpp index ff1886233..1dd2442e3 100644 --- a/utils/testbc/stats.cpp +++ b/utils/testbc/stats.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/threadpool/threadpool.cpp b/utils/threadpool/threadpool.cpp index 589fb6dcc..e62de7769 100644 --- a/utils/threadpool/threadpool.cpp +++ b/utils/threadpool/threadpool.cpp @@ -409,6 +409,24 @@ void ThreadPool::beginThread() throw() --fIssued; --waitingFunctorsSize; fWaitingFunctors.erase(todo); + if (fDebug) + { + ostringstream oss; + oss << "Ending thread " << " on " << fName + << " max " << fMaxThreads + << " queue " << fQueueSize + << " threads " << fThreadCount + << " running " << fIssued + << " waiting " << (waitingFunctorsSize - fIssued) + << " total " << waitingFunctorsSize; + logging::Message::Args args; + logging::Message message(0); + args.add(oss.str()); + message.format( args ); + logging::LoggingID lid(22); + logging::MessageLog ml(lid); + ml.logWarningMessage( message ); + } } timeout = boost::get_system_time() + boost::posix_time::minutes(10); @@ -536,6 +554,8 @@ void ThreadPoolMonitor::operator()() << setw(4) << tv.tv_usec / 100 << " Name " << fPool->fName << " Active " << fPool->waitingFunctorsSize + << " running " << fPool->fIssued + << " waiting " << (fPool->waitingFunctorsSize - fPool->fIssued) << " ThdCnt " << fPool->fThreadCount << " Max " << fPool->fMaxThreads << " Q " << fPool->fQueueSize diff --git a/utils/udfsdk/allnull.cpp b/utils/udfsdk/allnull.cpp index ee6669789..79f978124 100644 --- a/utils/udfsdk/allnull.cpp +++ b/utils/udfsdk/allnull.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/allnull.h b/utils/udfsdk/allnull.h index 40e5ce709..203bfbbaf 100644 --- a/utils/udfsdk/allnull.h +++ b/utils/udfsdk/allnull.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/avg_mode.cpp b/utils/udfsdk/avg_mode.cpp index 317ccce93..87b2d6b2e 100644 --- a/utils/udfsdk/avg_mode.cpp +++ b/utils/udfsdk/avg_mode.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/avg_mode.h b/utils/udfsdk/avg_mode.h index d37c3b83b..da0962c7f 100644 --- a/utils/udfsdk/avg_mode.h +++ b/utils/udfsdk/avg_mode.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/avgx.cpp b/utils/udfsdk/avgx.cpp index a7ee4eb75..b0c666541 100644 --- a/utils/udfsdk/avgx.cpp +++ b/utils/udfsdk/avgx.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/avgx.h b/utils/udfsdk/avgx.h index 0268df021..61d3d02b6 100644 --- a/utils/udfsdk/avgx.h +++ b/utils/udfsdk/avgx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/distinct_count.cpp b/utils/udfsdk/distinct_count.cpp index 11c2ce776..e622bf324 100644 --- a/utils/udfsdk/distinct_count.cpp +++ b/utils/udfsdk/distinct_count.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/distinct_count.h b/utils/udfsdk/distinct_count.h index 7ad43f952..5e0fa84ac 100644 --- a/utils/udfsdk/distinct_count.h +++ b/utils/udfsdk/distinct_count.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/mcsv1_udaf.cpp b/utils/udfsdk/mcsv1_udaf.cpp index 4dc30a3ef..b16036e05 100644 --- a/utils/udfsdk/mcsv1_udaf.cpp +++ b/utils/udfsdk/mcsv1_udaf.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/mcsv1_udaf.h b/utils/udfsdk/mcsv1_udaf.h index d55002c49..79d40ccf5 100644 --- a/utils/udfsdk/mcsv1_udaf.h +++ b/utils/udfsdk/mcsv1_udaf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/median.cpp b/utils/udfsdk/median.cpp index 2d4750e4d..3ef7a0187 100644 --- a/utils/udfsdk/median.cpp +++ b/utils/udfsdk/median.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/median.h b/utils/udfsdk/median.h index ead9eede4..5ae3025dd 100644 --- a/utils/udfsdk/median.h +++ b/utils/udfsdk/median.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/ssq.cpp b/utils/udfsdk/ssq.cpp index 4886acdb1..9b4c411aa 100644 --- a/utils/udfsdk/ssq.cpp +++ b/utils/udfsdk/ssq.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/utils/udfsdk/ssq.h b/utils/udfsdk/ssq.h index 58d42084b..c291d7fd1 100644 --- a/utils/udfsdk/ssq.h +++ b/utils/udfsdk/ssq.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 MariaDB Corporaton +/* Copyright (C) 2017 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/versioning/BRM/slavecomm.cpp b/versioning/BRM/slavecomm.cpp index 38aa35d00..e61fe60f8 100644 --- a/versioning/BRM/slavecomm.cpp +++ b/versioning/BRM/slavecomm.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/versioning/BRM/tracer.cpp b/versioning/BRM/tracer.cpp index d2cd35ccc..869b82197 100644 --- a/versioning/BRM/tracer.cpp +++ b/versioning/BRM/tracer.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 86124a783..fe0eaa70f 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -570,14 +570,16 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, } // Swap byte order before comparing character string - int64_t binChar = static_cast( uint64ToStr( - *(reinterpret_cast(charTmpBuf)) ) ); + // Compare must be unsigned + uint64_t compChar = uint64ToStr( *(reinterpret_cast(charTmpBuf)) ); + int64_t binChar = static_cast( compChar ); // Update min/max range - if (binChar < bufStats.minBufferVal) + uint64_t minVal = static_cast( bufStats.minBufferVal ); + uint64_t maxVal = static_cast( bufStats.maxBufferVal ); + if (compChar < minVal) bufStats.minBufferVal = binChar; - - if (binChar > bufStats.maxBufferVal) + if (compChar > maxVal) bufStats.maxBufferVal = binChar; pVal = charTmpBuf; diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 460a48191..40d48f8f2 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -423,8 +423,7 @@ int Dctnry::closeDctnry(bool realClose) return rc; //cout <<"Init called! m_dctnryOID =" << m_dctnryOID << endl; - if (realClose) - freeStringCache( ); + freeStringCache( ); return NO_ERROR; } diff --git a/writeengine/redistribute/we_redistributecontrol.cpp b/writeengine/redistribute/we_redistributecontrol.cpp index c28ebfef5..c0c975cb3 100644 --- a/writeengine/redistribute/we_redistributecontrol.cpp +++ b/writeengine/redistribute/we_redistributecontrol.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/writeengine/redistribute/we_redistributecontrolthread.cpp b/writeengine/redistribute/we_redistributecontrolthread.cpp index 70b5d1e2d..90f4fbaf9 100644 --- a/writeengine/redistribute/we_redistributecontrolthread.cpp +++ b/writeengine/redistribute/we_redistributecontrolthread.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/writeengine/splitter/we_cmdargs.cpp b/writeengine/splitter/we_cmdargs.cpp index 7ed626f26..8c520924d 100644 --- a/writeengine/splitter/we_cmdargs.cpp +++ b/writeengine/splitter/we_cmdargs.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/writeengine/wrapper/tdriver.cpp b/writeengine/wrapper/tdriver.cpp index ecabe1a10..f2044e3e8 100644 --- a/writeengine/wrapper/tdriver.cpp +++ b/writeengine/wrapper/tdriver.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporaton + Copyright (C) 2016 MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License