1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

MCOL-4530: toCppCode() method for ParseTree and TreeNode (#2777)

* toCppCode for ParseTree and TreeNode

* generated tree is compiling

* Put tree constructors into tests

* Minor fixes

* Fixed parse + some constructors

* Fixed includes, removed debug and old data

* Hopefully fix clang errors

* Forgot an override

* More overrides
This commit is contained in:
Andrey Piskunov 2023-03-22 22:25:06 +02:00 committed by GitHub
parent 75da821839
commit 256691652d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 2280 additions and 5130 deletions

View File

@ -151,6 +151,17 @@ const string AggregateColumn::toString() const
return output.str();
}
string AggregateColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("aggregatecolumn.h");
stringstream ss;
auto fContent = fData.substr(fFunctionName.size() + 1, fData.size() - fFunctionName.size() - 2);
ss << "AggregateColumn(" << std::quoted(fFunctionName) << ", " << std::quoted(fContent) << ", " << sessionID() << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const AggregateColumn& rhs)
{
output << rhs.toString();

View File

@ -166,7 +166,7 @@ class AggregateColumn : public ReturnedColumn
*
* deep copy of this pointer and return the copy
*/
inline virtual AggregateColumn* clone() const
inline virtual AggregateColumn* clone() const override
{
return new AggregateColumn(*this);
}
@ -189,14 +189,14 @@ class AggregateColumn : public ReturnedColumn
/**
* ASC flag
*/
inline virtual bool asc() const
inline virtual bool asc() const override
{
return fAsc;
}
/**
* ASC flag
*/
inline virtual void asc(const bool asc)
inline virtual void asc(const bool asc) override
{
fAsc = asc;
}
@ -204,7 +204,7 @@ class AggregateColumn : public ReturnedColumn
/**
* fData: SQL representation of this object
*/
virtual const std::string data() const
virtual const std::string data() const override
{
return fData;
}
@ -220,23 +220,24 @@ class AggregateColumn : public ReturnedColumn
/**
* Overloaded stream operator
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/**
* Serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void serialize(messageqcpp::ByteStream&) const override;
/**
* Serialize interface
*/
virtual void unserialize(messageqcpp::ByteStream&);
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -251,7 +252,7 @@ class AggregateColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -307,8 +308,8 @@ class AggregateColumn : public ReturnedColumn
static AggOp agname2num(const std::string&);
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate();
virtual bool hasWindowFunc()
virtual bool hasAggregate() override;
virtual bool hasWindowFunc() override
{
return false;
}
@ -355,7 +356,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getStrVal(fTimeZone);
@ -364,7 +365,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getIntVal();
@ -373,7 +374,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getUintVal();
@ -382,7 +383,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getFloatVal();
@ -391,7 +392,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDoubleVal();
@ -400,7 +401,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getLongDoubleVal();
@ -409,7 +410,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDecimalVal();
@ -417,7 +418,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDateIntVal();
@ -425,7 +426,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimeIntVal();
@ -433,7 +434,7 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDatetimeIntVal();
@ -441,14 +442,14 @@ class AggregateColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimestampIntVal();
}
private:
void evaluate(rowgroup::Row& row, bool& isNull);
void evaluate(rowgroup::Row& row, bool& isNull) override;
};
/**

View File

@ -309,6 +309,15 @@ const string ArithmeticColumn::toString() const
return oss.str();
}
string ArithmeticColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("arithmeticcolumn.h");
stringstream ss;
ss << "ArithmeticColumn(" << std::quoted(fData) << ", " << sessionID() << ")";
return ss.str();
}
void ArithmeticColumn::serialize(messageqcpp::ByteStream& b) const
{
b << static_cast<ObjectReader::id_t>(ObjectReader::ARITHMETICCOLUMN);

View File

@ -86,7 +86,7 @@ class ArithmeticColumn : public ReturnedColumn
/**
* get asc flag
*/
inline bool asc() const
inline bool asc() const override
{
return fAsc;
}
@ -94,7 +94,7 @@ class ArithmeticColumn : public ReturnedColumn
/**
* set asc flag
*/
inline void asc(const bool asc)
inline void asc(const bool asc) override
{
fAsc = asc;
}
@ -102,7 +102,7 @@ class ArithmeticColumn : public ReturnedColumn
/**
* get SQL representation of this object
*/
virtual const std::string data() const
virtual const std::string data() const override
{
return fData;
}
@ -110,7 +110,7 @@ class ArithmeticColumn : public ReturnedColumn
/**
* set SQL representation of this object
*/
virtual void data(const std::string data)
virtual void data(const std::string data) override
{
fData = data;
}
@ -118,13 +118,13 @@ class ArithmeticColumn : public ReturnedColumn
/**
* virtual stream method
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual ArithmeticColumn* clone() const
inline virtual ArithmeticColumn* clone() const override
{
return new ArithmeticColumn(*this);
}
@ -132,15 +132,15 @@ class ArithmeticColumn : public ReturnedColumn
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -154,7 +154,7 @@ class ArithmeticColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -164,16 +164,16 @@ class ArithmeticColumn : public ReturnedColumn
bool operator!=(const ArithmeticColumn& t) const;
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate();
virtual bool hasWindowFunc();
virtual bool hasAggregate() override;
virtual bool hasWindowFunc() override;
virtual void setDerivedTable();
virtual void replaceRealCol(std::vector<SRCP>&);
virtual const std::vector<SimpleColumn*>& simpleColumnList() const
virtual void setDerivedTable() override;
virtual void replaceRealCol(std::vector<SRCP>&) override;
virtual const std::vector<SimpleColumn*>& simpleColumnList() const override
{
return fSimpleColumnList;
}
virtual void setSimpleColumnList();
virtual void setSimpleColumnList() override;
/**
* Return the table that the column arguments belong to.
@ -181,7 +181,9 @@ class ArithmeticColumn : public ReturnedColumn
* @return tablename, if all arguments belong to one table
* empty string "", if multiple tables are involved in this func
*/
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan);
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
std::string fTableAlias; // table alias for this column
@ -209,62 +211,62 @@ class ArithmeticColumn : public ReturnedColumn
* F&E framework *
***********************************************************/
public:
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getStrVal(row, isNull);
}
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getIntVal(row, isNull);
}
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getUintVal(row, isNull);
}
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getFloatVal(row, isNull);
}
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getDoubleVal(row, isNull);
}
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getLongDoubleVal(row, isNull);
}
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getDecimalVal(row, isNull);
}
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getDateIntVal(row, isNull);
}
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getDatetimeIntVal(row, isNull);
}
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getTimestampIntVal(row, isNull);
}
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getTimeIntVal(row, isNull);
}
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull)
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
{
return fExpression->getBoolVal(row, isNull);
}

View File

@ -54,7 +54,7 @@ class ArithmeticOperator : public Operator
*
* deep copy of this pointer and return the copy
*/
inline virtual ArithmeticOperator* clone() const
inline virtual ArithmeticOperator* clone() const override
{
return new ArithmeticOperator(*this);
}
@ -71,15 +71,15 @@ class ArithmeticOperator : public Operator
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -93,7 +93,7 @@ class ArithmeticOperator : public Operator
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -106,46 +106,46 @@ class ArithmeticOperator : public Operator
* F&E framework *
***********************************************************/
using Operator::evaluate;
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop);
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override;
using Operator::getStrVal;
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getStrVal(fTimeZone);
}
using Operator::getIntVal;
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getIntVal();
}
using Operator::getUintVal;
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getUintVal();
}
using Operator::getFloatVal;
virtual float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getFloatVal();
}
using Operator::getDoubleVal;
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getDoubleVal();
}
using Operator::getLongDoubleVal;
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getLongDoubleVal();
}
using Operator::getDecimalVal;
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
@ -164,31 +164,31 @@ class ArithmeticOperator : public Operator
return TreeNode::getDecimalVal();
}
using Operator::getDateIntVal;
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getDateIntVal();
}
using Operator::getDatetimeIntVal;
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getDatetimeIntVal();
}
using Operator::getTimestampIntVal;
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getTimestampIntVal();
}
using Operator::getTimeIntVal;
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getTimeIntVal();
}
using Operator::getBoolVal;
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
evaluate(row, isNull, lop, rop);
return TreeNode::getBoolVal();
@ -203,6 +203,15 @@ class ArithmeticOperator : public Operator
fDecimalOverflowCheck = check;
}
inline virtual std::string toCppCode(IncludeSet& includes) const override
{
includes.insert("arithmeticoperator.h");
std::stringstream ss;
ss << "ArithmeticOperator(" << std::quoted(fData) << ")";
return ss.str();
}
private:
template <typename result_t>
inline result_t execute(result_t op1, result_t op2, bool& isNull);

View File

@ -224,6 +224,15 @@ const string ConstantColumn::toString() const
return oss.str();
}
std::string ConstantColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("constantcolumn.h");
std::stringstream ss;
ss << "ConstantColumn(" << std::quoted(fData) << ", " << fConstval << ")";
return ss.str();
}
const string ConstantColumn::data() const
{
return fData;

View File

@ -72,6 +72,7 @@ class ConstantColumn : public ReturnedColumn
* ctor
*/
ConstantColumn(const uint64_t val, TYPE type = NUM, int8_t scale = 0, uint8_t precision = 0); // deprecate
// There are more ctors below...
/**
@ -127,24 +128,25 @@ class ConstantColumn : public ReturnedColumn
/**
* accessor
*/
virtual const std::string data() const;
virtual const std::string data() const override;
/**
* accessor
*/
virtual void data(const std::string data)
virtual void data(const std::string data) override
{
fData = data;
}
/**
* accessor
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual ConstantColumn* clone() const
inline virtual ConstantColumn* clone() const override
{
return new ConstantColumn(*this);
}
@ -155,18 +157,18 @@ class ConstantColumn : public ReturnedColumn
/**
* serialize
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void serialize(messageqcpp::ByteStream&) const override;
/**
* unserialize
*/
virtual void unserialize(messageqcpp::ByteStream&);
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -180,7 +182,7 @@ class ConstantColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -189,13 +191,13 @@ class ConstantColumn : public ReturnedColumn
*/
bool operator!=(const ConstantColumn& t) const;
virtual bool hasWindowFunc()
virtual bool hasWindowFunc() override
{
return false;
}
/** Constant column on the filte can always be moved into derived table */
virtual void setDerivedTable()
virtual void setDerivedTable() override
{
fDerivedTable = std::string("*");
}
@ -244,7 +246,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull)
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return TreeNode::getBoolVal();
@ -252,7 +254,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.strVal;
@ -260,7 +262,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.intVal;
@ -268,7 +270,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.uintVal;
@ -276,7 +278,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.floatVal;
@ -284,7 +286,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.doubleVal;
@ -292,7 +294,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
return fResult.decimalVal;
@ -300,7 +302,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
@ -315,7 +317,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
@ -330,7 +332,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);
@ -345,7 +347,7 @@ class ConstantColumn : public ReturnedColumn
/**
* F&E
*/
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
isNull = isNull || (fType == NULLDATA);

View File

@ -94,6 +94,13 @@ ConstantFilter::ConstantFilter(const ConstantFilter& rhs) : Filter(rhs), fOp(rhs
}
}
ConstantFilter::ConstantFilter(const SOP& op, const FilterList& filterList, const SRCP& col,
const std::string& functionName, const std::string& data)
: fOp(op), fFilterList(filterList), fCol(col), fFunctionName(functionName)
{
fData = data;
}
ConstantFilter::~ConstantFilter()
{
}
@ -122,6 +129,25 @@ const string ConstantFilter::toString() const
return output.str();
}
string ConstantFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("constantfilter.h");
stringstream ss;
ss << "ConstantFilter(boost::shared_ptr<Operator>(new " << fOp->toCppCode(includes)
<< "), ConstantFilter::FilterList{";
if (!fFilterList.empty())
{
for (size_t i = 0; i < fFilterList.size() - 1; i++)
ss << "boost::shared_ptr<SimpleFilter>(new " << fFilterList.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<SimpleFilter>(new " << fFilterList.back()->toCppCode(includes) << ")";
}
ss << "}, ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fCol->toCppCode(includes) << "), "
<< std::quoted(fFunctionName) << ", " << std::quoted(fData) << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const ConstantFilter& rhs)
{
output << rhs.toString();

View File

@ -65,6 +65,9 @@ class ConstantFilter : public Filter
ConstantFilter();
ConstantFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs);
ConstantFilter(SimpleFilter* sf);
// for code generation purposes only
ConstantFilter(const SOP& op, const FilterList& filterList, const SRCP& col,
const std::string& functionName, const std::string& data);
// not needed yet
// ConstantFilter(const ConstantFilter& rhs);
@ -101,7 +104,6 @@ class ConstantFilter : public Filter
{
fCol = col;
}
/**
* Operations
*/
@ -112,20 +114,20 @@ class ConstantFilter : public Filter
}
// virtual const std::string data() const;
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -139,7 +141,7 @@ class ConstantFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -177,7 +179,7 @@ class ConstantFilter : public Filter
fFunctionName = functionName;
}
void setDerivedTable();
void setDerivedTable() override;
virtual void replaceRealCol(std::vector<SRCP>&);
virtual bool hasAggregate();
@ -186,18 +188,17 @@ class ConstantFilter : public Filter
FilterList fFilterList; /// vector of simple filters
SRCP fCol; /// the common column
std::string fFunctionName; /// function name
/***********************************************************
* F&E framework *
***********************************************************/
public:
ConstantFilter(const ConstantFilter& rhs);
inline virtual ConstantFilter* clone() const
inline virtual ConstantFilter* clone() const override
{
return new ConstantFilter(*this);
}
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull);
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
// get all simple columns involved in this column
const std::vector<SimpleColumn*>& simpleColumnList();

View File

@ -61,6 +61,16 @@ const string ExistsFilter::toString() const
return oss.str();
}
string ExistsFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("existsfilter.h");
stringstream ss;
ss << "ExistsFilter(boost::shared_ptr<CalpontSelectExecutionPlan>(), " << fNotExists << ", " << fCorrelated
<< ")";
return ss.str();
}
ostream& operator<<(ostream& output, const ExistsFilter& rhs)
{
output << rhs.toString();

View File

@ -87,19 +87,19 @@ class ExistsFilter : public Filter
* Overloaded stream operator
*/
// virtual std::ostream& operator<< (std::ostream& output);
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual ExistsFilter* clone() const
inline virtual ExistsFilter* clone() const override
{
return new ExistsFilter(*this);
}
@ -109,7 +109,7 @@ class ExistsFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -123,7 +123,7 @@ class ExistsFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*

View File

@ -70,6 +70,15 @@ const string Filter::toString() const
return string(">Filter<");
}
string Filter::toCppCode(IncludeSet& includes) const
{
includes.insert("filter.h");
stringstream ss;
ss << "Filter(" << std::quoted(fData) << ")";
return ss.str();
}
bool Filter::operator==(const Filter& t) const
{
if (data() == t.data())

View File

@ -75,13 +75,15 @@ class Filter : public TreeNode
/**
* Operations
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual const std::string data() const
virtual std::string toCppCode(IncludeSet& includes) const override;
virtual const std::string data() const override
{
return fData;
}
virtual void data(const std::string data)
virtual void data(const std::string data) override
{
fData = data;
}
@ -90,7 +92,7 @@ class Filter : public TreeNode
*
* deep copy of this pointer and return the copy
*/
inline virtual Filter* clone() const
inline virtual Filter* clone() const override
{
return new Filter(*this);
}
@ -98,15 +100,15 @@ class Filter : public TreeNode
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -120,7 +122,7 @@ class Filter : public TreeNode
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -150,11 +152,6 @@ class Filter : public TreeNode
protected:
uint64_t fCardinality;
private:
// default okay
// Filter& operator=(const Filter& rhs);
std::string fData;
};

View File

@ -134,6 +134,18 @@ const string FunctionColumn::toString() const
return output.str();
}
string FunctionColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("functioncolumn.h");
stringstream ss;
auto fFuncParmsInString = fData.substr(fFunctionName.size() + 1, fData.size() - fFunctionName.size() - 2);
ss << "FunctionColumn(" << std::quoted(fFunctionName) << ", " << std::quoted(fFuncParmsInString) << ", " << sessionID() << ")";
return ss.str();
}
const string FunctionColumn::data() const
{
return fData;

View File

@ -131,19 +131,19 @@ class FunctionColumn : public ReturnedColumn
fTimeZone = timeZone;
}
virtual const std::string data() const;
virtual void data(const std::string data)
virtual const std::string data() const override;
virtual void data(const std::string data) override
{
fData = data;
}
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual FunctionColumn* clone() const
inline virtual FunctionColumn* clone() const override
{
return new FunctionColumn(*this);
}
@ -151,20 +151,20 @@ class FunctionColumn : public ReturnedColumn
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate();
virtual bool hasWindowFunc();
virtual void setDerivedTable();
virtual void replaceRealCol(std::vector<SRCP>&);
virtual const std::vector<SimpleColumn*>& simpleColumnList() const
virtual bool hasAggregate() override;
virtual bool hasWindowFunc() override;
virtual void setDerivedTable() override;
virtual void replaceRealCol(std::vector<SRCP>&) override;
virtual const std::vector<SimpleColumn*>& simpleColumnList() const override
{
return fSimpleColumnList;
}
virtual void setSimpleColumnList();
virtual void setSimpleColumnList() override;
/**
* Return the tableAlias name of the table that the column arguments belong to.
*
@ -172,7 +172,9 @@ class FunctionColumn : public ReturnedColumn
* @return true, if all arguments belong to one table
* false, if multiple tables are involved in the function
*/
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan);
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
/**
@ -188,7 +190,7 @@ class FunctionColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -202,7 +204,7 @@ class FunctionColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -215,38 +217,38 @@ class FunctionColumn : public ReturnedColumn
* F&E framework *
***********************************************************/
public:
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
fResult.strVal = fFunctor->getStrVal(row, fFunctionParms, isNull, fOperationType);
return fResult.strVal;
}
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getIntVal(row, fFunctionParms, isNull, fOperationType);
}
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getUintVal(row, fFunctionParms, isNull, fOperationType);
}
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getFloatVal(row, fFunctionParms, isNull, fOperationType);
}
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getDoubleVal(row, fFunctionParms, isNull, fOperationType);
}
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getLongDoubleVal(row, fFunctionParms, isNull, fOperationType);
}
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
IDB_Decimal decimal = fFunctor->getDecimalVal(row, fFunctionParms, isNull, fOperationType);
@ -292,27 +294,27 @@ class FunctionColumn : public ReturnedColumn
decimal.precision = std::max(fResultType.precision, static_cast<int32_t>(decimal.precision));
return decimal;
}
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull)
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getBoolVal(row, fFunctionParms, isNull, fOperationType);
}
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getDateIntVal(row, fFunctionParms, isNull, fOperationType);
}
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getDatetimeIntVal(row, fFunctionParms, isNull, fOperationType);
}
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getTimestampIntVal(row, fFunctionParms, isNull, fOperationType);
}
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
fOperationType.setTimeZone(fTimeZone);
return fFunctor->getTimeIntVal(row, fFunctionParms, isNull, fOperationType);

View File

@ -80,6 +80,15 @@ const string GroupConcatColumn::toString() const
return output.str();
}
string GroupConcatColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("groupconcatcolumn.h");
stringstream ss;
ss << "GroupConcatColumn(" << sessionID() << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const GroupConcatColumn& rhs)
{
output << rhs.toString();

View File

@ -64,13 +64,13 @@ class GroupConcatColumn : public AggregateColumn
/**
* Overloaded stream operator
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
virtual GroupConcatColumn* clone() const
virtual GroupConcatColumn* clone() const override
{
return new GroupConcatColumn(*this);
}
@ -98,8 +98,8 @@ class GroupConcatColumn : public AggregateColumn
/**
* Serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -107,7 +107,7 @@ class GroupConcatColumn : public AggregateColumn
* @return true iff every member of t is a duplicate copy of every member of this;
* false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -124,7 +124,7 @@ class GroupConcatColumn : public AggregateColumn
* @return false iff every member of t is a duplicate copy of every member of this;
* true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -135,6 +135,8 @@ class GroupConcatColumn : public AggregateColumn
using AggregateColumn::operator!=;
virtual bool operator!=(const GroupConcatColumn& t) const;
virtual string toCppCode(IncludeSet& includes) const override;
private:
std::vector<SRCP> fOrderCols;
std::string fSeparator;

View File

@ -33,7 +33,6 @@ using namespace boost;
#include "intervalcolumn.h"
using namespace funcexp;
namespace execplan
{
/**
@ -68,6 +67,16 @@ const string IntervalColumn::toString() const
return output.str();
}
string IntervalColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("intervalcolumn.h");
stringstream ss;
ss << "IntervalColumn(boost::shared_ptr<ReturnedColumn>(new " << fVal->toCppCode(includes) << "), " << fIntervalType << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const IntervalColumn& rhs)
{
output << rhs.toString();

View File

@ -98,22 +98,24 @@ class IntervalColumn : public ReturnedColumn
{
fIntervalType = intervalType;
}
const std::string toString() const;
inline virtual IntervalColumn* clone() const
const std::string toString() const override;
inline virtual IntervalColumn* clone() const override
{
return new IntervalColumn(*this);
}
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate()
virtual bool hasAggregate() override
{
return false;
}
virtual bool hasWindowFunc()
virtual bool hasWindowFunc() override
{
return false;
}
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
/**
* Fields
@ -122,12 +124,12 @@ class IntervalColumn : public ReturnedColumn
int fIntervalType;
// okay to be private for now.
virtual bool operator==(const TreeNode* t) const
virtual bool operator==(const TreeNode* t) const override
{
return false;
}
bool operator==(const IntervalColumn& t) const;
virtual bool operator!=(const TreeNode* t) const
virtual bool operator!=(const TreeNode* t) const override
{
return false;
}

View File

@ -168,4 +168,13 @@ bool JsonArrayAggColumn::operator!=(const TreeNode* t) const
return !(*this == t);
}
string JsonArrayAggColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("jsonarrayaggcolumn.h");
stringstream ss;
ss << "JsonArrayAggColumn(" << sessionID() << ")";
return ss.str();
}
} // namespace execplan

View File

@ -59,13 +59,13 @@ class JsonArrayAggColumn : public AggregateColumn
/**
* Overloaded stream operator
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
virtual JsonArrayAggColumn* clone() const
virtual JsonArrayAggColumn* clone() const override
{
return new JsonArrayAggColumn(*this);
}
@ -93,8 +93,8 @@ class JsonArrayAggColumn : public AggregateColumn
/**
* Serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -102,7 +102,7 @@ class JsonArrayAggColumn : public AggregateColumn
* @return true iff every member of t is a duplicate copy of every member of this;
* false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -119,7 +119,7 @@ class JsonArrayAggColumn : public AggregateColumn
* @return false iff every member of t is a duplicate copy of every member of this;
* true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -130,6 +130,8 @@ class JsonArrayAggColumn : public AggregateColumn
using AggregateColumn::operator!=;
virtual bool operator!=(const JsonArrayAggColumn& t) const;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
std::vector<SRCP> fOrderCols;
std::string fSeparator;

View File

@ -80,7 +80,7 @@ class LogicOperator : public Operator
*
* deep copy of this pointer and return the copy
*/
inline virtual LogicOperator* clone() const
inline virtual LogicOperator* clone() const override
{
return new LogicOperator(*this);
}
@ -88,15 +88,15 @@ class LogicOperator : public Operator
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -110,7 +110,7 @@ class LogicOperator : public Operator
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -123,7 +123,7 @@ class LogicOperator : public Operator
// F&E framework
using Operator::getBoolVal;
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
switch (fOp)
{
@ -165,11 +165,20 @@ class LogicOperator : public Operator
}
using TreeNode::evaluate;
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop)
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
{
fResult.boolVal = getBoolVal(row, isNull, lop, rop);
}
inline virtual std::string toCppCode(IncludeSet& includes) const override
{
includes.insert("logicoperator.h");
std::stringstream ss;
ss << "LogicOperator(" << std::quoted(fData) << ")";
return ss.str();
}
private:
// default okay
// Operator& operator=(const Operator& rhs);

View File

@ -177,6 +177,15 @@ const string Operator::toString() const
return oss.str();
}
string Operator::toCppCode(IncludeSet& includes) const
{
includes.insert("operator.h");
stringstream ss;
ss << "Operator(" << std::quoted(fData) << ")";
return ss.str();
}
Operator* Operator::opposite() const
{
if (fData.compare(">") == 0)

View File

@ -75,18 +75,18 @@ class Operator : public TreeNode
virtual ~Operator();
virtual const std::string toString() const;
virtual const std::string data() const
virtual const std::string toString() const override;
virtual const std::string data() const override
{
return fData;
}
virtual void data(const std::string data);
virtual void data(const std::string data) override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual Operator* clone() const
inline virtual Operator* clone() const override
{
return new Operator(*this);
}
@ -101,15 +101,15 @@ class Operator : public TreeNode
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -123,7 +123,7 @@ class Operator : public TreeNode
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -139,6 +139,8 @@ class Operator : public TreeNode
*/
virtual void reverseOp();
virtual std::string toCppCode(IncludeSet& includes) const override;
protected:
std::string fData;
@ -228,11 +230,11 @@ class Operator : public TreeNode
virtual void setOpType(Type& l, Type& r)
{
}
virtual void operationType(const Type& ot)
virtual void operationType(const Type& ot) override
{
fOperationType = ot;
}
virtual const Type& operationType() const
virtual const Type& operationType() const override
{
return fOperationType;
}

View File

@ -66,6 +66,16 @@ const string OuterJoinOnFilter::toString() const
return oss.str();
}
string OuterJoinOnFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("outerjoinonfilter.h");
stringstream ss;
ss << "OuterJoinOnFilter(boost::shared_ptr<ParseTree>(new " << fPt->toCppCode(includes) << "))";
return ss.str();
}
ostream& operator<<(ostream& output, const OuterJoinOnFilter& rhs)
{
output << rhs.toString();

View File

@ -69,19 +69,19 @@ class OuterJoinOnFilter : public Filter
* Overloaded stream operator
*/
// virtual std::ostream& operator<< (std::ostream& output);
virtual const std::string toString() const;
virtual const std::string toString() const override;
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual OuterJoinOnFilter* clone() const
inline virtual OuterJoinOnFilter* clone() const override
{
return new OuterJoinOnFilter(*this);
}
@ -91,7 +91,7 @@ class OuterJoinOnFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -105,7 +105,7 @@ class OuterJoinOnFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -113,7 +113,7 @@ class OuterJoinOnFilter : public Filter
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
bool operator!=(const OuterJoinOnFilter& t) const;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
// default okay?
// OuterJoinOnFilter& operator=(const OuterJoinOnFilter& rhs);

View File

@ -31,7 +31,9 @@
#include "operator.h"
#include "mcs_decimal.h"
#include <boost/core/demangle.hpp>
#include <sstream>
#include <string>
#include <unordered_set>
namespace rowgroup
{
@ -58,6 +60,7 @@ class ParseTree
*/
inline ParseTree();
inline ParseTree(TreeNode* data);
inline ParseTree(TreeNode* data, ParseTree* left, ParseTree* right);
inline ParseTree(const ParseTree& rhs);
inline virtual ~ParseTree();
@ -161,6 +164,9 @@ class ParseTree
*/
inline std::string toString() const;
inline std::string toCppCode(std::unordered_set<std::string>& includes) const;
inline void codeToFile(std::string filename, std::string varname) const;
/** assignment operator
*
*/
@ -359,6 +365,13 @@ inline ParseTree::ParseTree(TreeNode* data) : fData(data), fLeft(0), fRight(0)
fDerivedTable = data->derivedTable();
}
inline ParseTree::ParseTree(TreeNode* data, ParseTree* left, ParseTree* right)
: fData(data), fLeft(left), fRight(right)
{
if (data)
fDerivedTable = data->derivedTable();
}
inline ParseTree::ParseTree(const ParseTree& rhs)
: fData(0), fLeft(0), fRight(0), fDerivedTable(rhs.fDerivedTable)
{
@ -521,10 +534,8 @@ inline void ParseTree::draw(const ParseTree* n, std::ostream& dotFile)
<< "n" << (void*)r << std::endl;
auto& node = *(n->data());
dotFile << "n" << (void*)n << " [label=\"" <<
n->data()->data() << " (" <<
n << ") " <<
boost::core::demangle(typeid(node).name()) << "\"]" << std::endl;
dotFile << "n" << (void*)n << " [label=\"" << n->data()->data() << " (" << n << ") "
<< boost::core::demangle(typeid(node).name()) << "\"]" << std::endl;
}
inline void ParseTree::drawTree(std::string filename)
@ -538,6 +549,30 @@ inline void ParseTree::drawTree(std::string filename)
dotFile.close();
}
inline string ParseTree::toCppCode(IncludeSet& includes) const
{
includes.insert("parsetree.h");
std::stringstream ss;
ss << "ParseTree(" << (data() ? ("new " + data()->toCppCode(includes)) : "nullptr") << ", "
<< (left() ? ("new " + left()->toCppCode(includes)) : "nullptr") << ", "
<< (right() ? ("new " + right()->toCppCode(includes)) : "nullptr") << ")";
return ss.str();
}
inline void ParseTree::codeToFile(std::string filename, std::string varname) const
{
ofstream hFile(filename.c_str(), std::ios::app);
IncludeSet includes;
auto result = toCppCode(includes);
for (const auto& inc : includes)
hFile << "#include \"" << inc << "\"\n";
hFile << "\n";
hFile << "namespace execplan \n{ auto " << varname << " = new " << result << ";\n}\n\n";
hFile.close();
}
inline void ParseTree::evaluate(rowgroup::Row& row, bool& isNull)
{
// Non-leaf node is operator. leaf node is SimpleFilter for logical expression,

View File

@ -60,7 +60,7 @@ class PredicateOperator : public Operator
*
* deep copy of this pointer and return the copy
*/
inline virtual PredicateOperator* clone() const
inline virtual PredicateOperator* clone() const override
{
return new PredicateOperator(*this);
}
@ -68,15 +68,15 @@ class PredicateOperator : public Operator
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -90,7 +90,7 @@ class PredicateOperator : public Operator
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -107,8 +107,17 @@ class PredicateOperator : public Operator
* F&E framework *
***********************************************************/
using Operator::getBoolVal;
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop);
void setOpType(Type& l, Type& r);
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop) override;
void setOpType(Type& l, Type& r) override;
inline virtual std::string toCppCode(IncludeSet& includes) const override
{
includes.insert("predicateoperator.h");
std::stringstream ss;
ss << "PredicateOperator(" << std::quoted(fData) << ")";
return ss.str();
}
private:
inline bool numericCompare(const IDB_Decimal& op1, const IDB_Decimal& op2);

View File

@ -133,6 +133,16 @@ const string PseudoColumn::toString() const
return output.str();
}
string PseudoColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("pseudocolumn.h");
stringstream ss;
ss << "PseudoColumn(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " << fisColumnStore << ", " << std::quoted(fColumnName)
<< ", " << fPseudoType << ", " << sessionID() << ")";
return ss.str();
}
void PseudoColumn::serialize(messageqcpp::ByteStream& b) const
{
b << (ObjectReader::id_t)ObjectReader::PSEUDOCOLUMN;

View File

@ -80,7 +80,7 @@ class PseudoColumn : public SimpleColumn
*
* deep copy of this pointer and return the copy
*/
inline virtual PseudoColumn* clone() const
inline virtual PseudoColumn* clone() const override
{
return new PseudoColumn(*this);
}
@ -106,17 +106,17 @@ class PseudoColumn : public SimpleColumn
/**
* The serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -130,7 +130,7 @@ class PseudoColumn : public SimpleColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -141,6 +141,8 @@ class PseudoColumn : public SimpleColumn
static uint32_t pseudoNameToType(std::string& name);
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
/**
* Fields

View File

@ -242,6 +242,16 @@ const string ReturnedColumn::toString() const
return oss.str();
}
string ReturnedColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("returnedcolumn.h");
stringstream ss;
ss << "ReturnedColumn(" << std::quoted(fData) << ")";
return ss.str();
}
// All columns that may have simple column added to the list need to implement
// this function. Default behavior is to have no SC added to the list so
// fSimpleColumnList will be cleared.

View File

@ -95,8 +95,8 @@ class ReturnedColumn : public TreeNode
/**
* Accessor Methods
*/
virtual const std::string data() const;
virtual void data(const std::string data)
virtual const std::string data() const override;
virtual void data(const std::string data) override
{
fData = data;
}
@ -231,22 +231,22 @@ class ReturnedColumn : public TreeNode
/**
* Operations
*/
virtual ReturnedColumn* clone() const = 0;
virtual ReturnedColumn* clone() const override = 0;
/**
* The serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual const std::string toString() const;
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -261,7 +261,7 @@ class ReturnedColumn : public TreeNode
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*

View File

@ -153,8 +153,7 @@ void collectCommonConjuctions(execplan::ParseTree* root, CommonContainer& accumu
// this utility function creates new and node
execplan::ParseTree* newAndNode()
{
execplan::Operator* op = new execplan::Operator();
op->data("and");
execplan::Operator* op = new execplan::LogicOperator("and");
return new execplan::ParseTree(op);
}
@ -357,9 +356,9 @@ void dumpTreeFiles(execplan::ParseTree* filters, const std::string& name, std::s
dumpfolder = startup::StartUp::tmpDir();
}
std::ofstream before(dumpfolder + "filters." + name + ".data");
std::ofstream before(dumpfolder + "filters" + name + ".data");
before << beforetree;
std::string dotname = dumpfolder + "filters." + name + ".dot";
std::string dotname = dumpfolder + "filters" + name + ".dot";
filters->drawTree(dotname);
std::string dotInvoke = "dot -Tpng ";
std::string convert = dotInvoke + dotname + " -o " + dotname + ".png";

View File

@ -59,6 +59,12 @@ RowColumn::RowColumn(const uint32_t sessionID) : ReturnedColumn(sessionID)
{
}
// For code geneartion purposes
RowColumn::RowColumn(const std::vector<SRCP>& columnVec, const uint32_t sessionID)
: ReturnedColumn(sessionID), fColumnVec(columnVec)
{
}
RowColumn::RowColumn(const RowColumn& rhs, const uint32_t sessionID) : ReturnedColumn(rhs, sessionID)
{
fColumnVec.clear();
@ -190,4 +196,20 @@ const string SubSelect::toString() const
return string(">SubSelect<");
}
string RowColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("rowcloumn.h");
stringstream ss;
ss << "RowColumn(std::vector<SRCP>{";
if (!fColumnVec.empty())
{
for (size_t i = 0; i < fColumnVec.size() - 1; i++)
ss << "boost::shared_ptr<ReturnedColumn>(new " << fColumnVec.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fColumnVec.back()->toCppCode(includes) << ")";
}
ss << "})";
return ss.str();
}
} // namespace execplan

View File

@ -58,7 +58,7 @@ class RowColumn : public ReturnedColumn
*/
RowColumn(const uint32_t sessionID = 0);
RowColumn(const RowColumn& rhs, const uint32_t sessionID = 0);
RowColumn(const std::vector<SRCP>& columnVec, const uint32_t sessionID = 0);
/**
* Destructor
*/
@ -80,7 +80,7 @@ class RowColumn : public ReturnedColumn
*
* deep copy of this pointer and return the copy
*/
inline virtual RowColumn* clone() const
inline virtual RowColumn* clone() const override
{
return new RowColumn(*this);
}
@ -95,20 +95,20 @@ class RowColumn : public ReturnedColumn
// virtual void serialize(messageqcpp::ByteStream&) const;
// virtual void unserialize(messageqcpp::ByteStream&);
virtual const std::string toString() const;
virtual const std::string toString() const override;
/**
* Serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -122,7 +122,7 @@ class RowColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -131,15 +131,17 @@ class RowColumn : public ReturnedColumn
*/
bool operator!=(const RowColumn& t) const;
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate()
virtual bool hasAggregate() override
{
return false;
}
virtual bool hasWindowFunc()
virtual bool hasWindowFunc() override
{
return false;
}
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
/**
* Fields
@ -157,20 +159,20 @@ class SubSelect : public ReturnedColumn
~SubSelect()
{
}
SubSelect* clone() const
SubSelect* clone() const override
{
return new SubSelect();
}
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate()
virtual bool hasAggregate() override
{
return false;
}
virtual bool hasWindowFunc()
virtual bool hasWindowFunc() override
{
return false;
}
virtual const std::string toString() const;
virtual const std::string toString() const override;
};
/**

View File

@ -38,7 +38,7 @@ SelectFilter::SelectFilter()
{
}
SelectFilter::SelectFilter(const vector<SRCP>& cols, const SOP& op, SCSEP& sub, bool correlated)
SelectFilter::SelectFilter(const vector<SRCP>& cols, const SOP& op, const SCSEP& sub, bool correlated)
: fCols(cols), fOp(op), fSub(sub), fCorrelated(correlated), fData("subselect"), fReturnedColPos(0)
{
}
@ -72,6 +72,23 @@ const string SelectFilter::toString() const
return oss.str();
}
string SelectFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("selectfilter.h");
stringstream ss;
ss << "SelectFilter(std::vector<SRCP>{";
if (!fCols.empty()) {
for (size_t i = 0; i < fCols.size() - 1 ;i++ )
ss << "boost::shared_ptr<ReturnedColumn>(new " << fCols.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fCols.back()->toCppCode(includes) << ")";
}
ss << "}, ";
ss << "boost::shared_ptr<Operator>(new " << fOp->toCppCode(includes) << "), ";
ss <<"boost::make_shared<CalpontSelectExecutionPlan>(), ";
ss << fCorrelated << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const SelectFilter& rhs)
{
output << rhs.toString();

View File

@ -58,7 +58,7 @@ class SelectFilter : public Filter
* pass all parts in ctor
* @note SimpleFilter takes ownership of all these pointers
*/
SelectFilter(const std::vector<SRCP>& cols, const SOP& op, SCSEP& sub, bool correlated = false);
SelectFilter(const std::vector<SRCP>& cols, const SOP& op, const SCSEP& sub, bool correlated = false);
/**
* Destructors
@ -107,13 +107,13 @@ class SelectFilter : public Filter
fCorrelated = correlated;
}
virtual const std::string toString() const;
virtual inline const std::string data() const
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
virtual inline const std::string data() const override
{
return fData;
}
virtual inline void data(const std::string data)
virtual inline void data(const std::string data) override
{
fData = data;
}
@ -130,14 +130,14 @@ class SelectFilter : public Filter
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual SelectFilter* clone() const
inline virtual SelectFilter* clone() const override
{
return new SelectFilter(*this);
}
@ -147,7 +147,7 @@ class SelectFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -161,7 +161,7 @@ class SelectFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*

View File

@ -275,6 +275,16 @@ const string SimpleColumn::toString() const
return output.str();
}
string SimpleColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("simplecolumn.h");
stringstream ss;
ss << "SimpleColumn(" << std::quoted(fData) << ", SimpleColumn::ForTestPurposeWithoutOID{})";
return ss.str();
}
void SimpleColumn::parse(const string& token)
{
// get schema name, table name and column name for token.
@ -379,7 +389,6 @@ void SimpleColumn::unserialize(messageqcpp::ByteStream& b)
b >> reinterpret_cast<ByteStream::doublebyte&>(fisColumnStore);
}
bool SimpleColumn::operator==(const SimpleColumn& t) const
{
const ReturnedColumn *rc1, *rc2;

View File

@ -123,8 +123,8 @@ class SimpleColumn : public ReturnedColumn
fOid = oid;
}
virtual const std::string data() const;
virtual void data(const std::string data)
virtual const std::string data() const override;
virtual void data(const std::string data) override
{
fData = data;
}
@ -178,7 +178,7 @@ class SimpleColumn : public ReturnedColumn
*
* deep copy of this pointer and return the copy
*/
inline virtual SimpleColumn* clone() const
inline virtual SimpleColumn* clone() const override
{
return new SimpleColumn(*this);
}
@ -190,17 +190,17 @@ class SimpleColumn : public ReturnedColumn
/**
* The serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual const std::string toString() const;
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
virtual const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -216,7 +216,7 @@ class SimpleColumn : public ReturnedColumn
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -226,7 +226,7 @@ class SimpleColumn : public ReturnedColumn
bool operator!=(const SimpleColumn& t) const;
/** @brief check if this column is the same as the argument */
virtual bool sameColumn(const ReturnedColumn* rc) const;
virtual bool sameColumn(const ReturnedColumn* rc) const override;
/** @brief return column type of this column (could be of any engine type) */
const CalpontSystemCatalog::ColType& colType() const
@ -237,12 +237,12 @@ class SimpleColumn : public ReturnedColumn
/** @brief set the column's OID from the syscat */
void setOID();
virtual bool hasWindowFunc()
virtual bool hasWindowFunc() override
{
return false;
}
void setDerivedTable();
void setDerivedTable() override;
/**
* Return the tableAlias name of the table that the column arguments belong to.
@ -251,7 +251,7 @@ class SimpleColumn : public ReturnedColumn
* @return true, if all arguments belong to one table
* false, if multiple tables are involved in the function
*/
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan);
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
protected:
/**
@ -281,49 +281,49 @@ class SimpleColumn : public ReturnedColumn
* F&E framework *
***********************************************************/
public:
virtual void evaluate(rowgroup::Row& row, bool& isNull);
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull)
virtual void evaluate(rowgroup::Row& row, bool& isNull) override;
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getBoolVal();
}
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getStrVal(fTimeZone);
}
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getIntVal();
}
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getUintVal();
}
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getFloatVal();
}
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDoubleVal();
}
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getLongDoubleVal();
}
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
@ -348,25 +348,25 @@ class SimpleColumn : public ReturnedColumn
return TreeNode::getDecimalVal();
}
inline int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
inline int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDateIntVal();
}
inline int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
inline int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDatetimeIntVal(fTimeZone);
}
inline int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
inline int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimestampIntVal();
}
inline int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
inline int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimeIntVal();

View File

@ -64,28 +64,41 @@ class SimpleColumn_Decimal : public SimpleColumn
{
}
inline virtual SimpleColumn_Decimal* clone() const
inline virtual SimpleColumn_Decimal* clone() const override
{
return new SimpleColumn_Decimal<len>(*this);
}
/** Evaluate methods */
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull);
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull);
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override;
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
/** The serialize interface */
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
uint64_t fNullVal;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
void setNullVal();
};
template <int len>
std::string SimpleColumn_Decimal<len>::toCppCode(IncludeSet& includes) const
{
includes.insert("simplecolumn_decimal.h");
std::stringstream ss;
ss << "SimpleColumn_Decimal<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " <<
std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")";
return ss.str();
}
template <int len>
SimpleColumn_Decimal<len>::SimpleColumn_Decimal() : SimpleColumn()
{

View File

@ -63,29 +63,42 @@ class SimpleColumn_INT : public SimpleColumn
{
}
inline virtual SimpleColumn_INT* clone() const
inline virtual SimpleColumn_INT* clone() const override
{
return new SimpleColumn_INT<len>(*this);
}
/** Evaluate methods */
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull);
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull);
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override;
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
/** The serialize interface */
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
uint64_t fNullVal;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
void setNullVal();
};
template <int len>
std::string SimpleColumn_INT<len>::toCppCode(IncludeSet& includes) const
{
includes.insert("simplecolumn_int.h");
std::stringstream ss;
ss << "SimpleColumn_INT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " <<
std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")";
return ss.str();
}
template <int len>
SimpleColumn_INT<len>::SimpleColumn_INT() : SimpleColumn()
{

View File

@ -63,29 +63,42 @@ class SimpleColumn_UINT : public SimpleColumn
{
}
inline virtual SimpleColumn_UINT* clone() const
inline virtual SimpleColumn_UINT* clone() const override
{
return new SimpleColumn_UINT<len>(*this);
}
/** Evaluate methods */
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull);
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull);
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull);
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull);
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull);
virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override;
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
/** The serialize interface */
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
uint64_t fNullVal;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
void setNullVal();
};
template <int len>
std::string SimpleColumn_UINT<len>::toCppCode(IncludeSet& includes) const
{
includes.insert("simplecolumn_uint.h");
std::stringstream ss;
ss << "SimpleColumn_UINT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName)
<< ", " << std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")";
return ss.str();
}
template <int len>
SimpleColumn_UINT<len>::SimpleColumn_UINT() : SimpleColumn()
{

View File

@ -250,6 +250,16 @@ const string SimpleFilter::toString() const
return output.str();
}
string SimpleFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("simplefilter.h");
stringstream ss;
ss << "SimpleFilter(" << std::quoted(data()) << ", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})";
return ss.str();
}
void SimpleFilter::parse(string sql, std::optional<ForTestPurposesWithoutColumnsOIDS> testFlag)
{
fLhs = 0;
@ -282,10 +292,10 @@ void SimpleFilter::parse(string sql, std::optional<ForTestPurposesWithoutColumns
string rhs = sql.substr(pos, sql.length());
if (rhs.at(0) == ' ')
rhs = rhs.substr(1, pos);
rhs = rhs.substr(1, rhs.length());
if (rhs.at(rhs.length() - 1) == ' ')
rhs = rhs.substr(0, pos - 1);
rhs = rhs.substr(0, rhs.length() - 1);
if (testFlag)
fRhs = new SimpleColumn(rhs, SimpleColumn::ForTestPurposeWithoutOID{});

View File

@ -75,7 +75,7 @@ class SimpleFilter : public Filter
virtual ~SimpleFilter();
inline virtual SimpleFilter* clone() const
inline virtual SimpleFilter* clone() const override
{
return new SimpleFilter(*this);
}
@ -106,7 +106,7 @@ class SimpleFilter : public Filter
}
using Filter::data;
virtual const std::string data() const;
virtual const std::string data() const override;
/** assign fLhs
*
@ -129,20 +129,20 @@ class SimpleFilter : public Filter
*/
void rhs(ReturnedColumn* rhs);
virtual const std::string toString() const;
virtual const std::string toString() const override;
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true if every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -168,7 +168,7 @@ class SimpleFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false if every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -215,12 +215,14 @@ class SimpleFilter : public Filter
/** @brief this function is called by the connector to set constant values according to the compare type */
void convertConstant();
void setDerivedTable();
void setDerivedTable() override;
virtual void replaceRealCol(std::vector<SRCP>&);
static std::string escapeString(const std::string& input);
virtual string toCppCode(IncludeSet& includes) const override;
private:
SOP fOp; /// operator
ReturnedColumn* fLhs; /// left operand
@ -235,10 +237,10 @@ class SimpleFilter : public Filter
* F&E framework *
***********************************************************/
public:
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull);
inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull);
inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull);
inline virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull);
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
inline virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
// get all simple columns involved in this column
const std::vector<SimpleColumn*>& simpleColumnList();

View File

@ -38,7 +38,7 @@ SimpleScalarFilter::SimpleScalarFilter()
{
}
SimpleScalarFilter::SimpleScalarFilter(const vector<SRCP>& cols, const SOP& op, SCSEP& sub)
SimpleScalarFilter::SimpleScalarFilter(const vector<SRCP>& cols, const SOP& op, const SCSEP& sub)
: fCols(cols), fOp(op), fSub(sub), fData("simple scalar")
{
}
@ -65,6 +65,23 @@ const string SimpleScalarFilter::toString() const
return oss.str();
}
string SimpleScalarFilter::toCppCode(IncludeSet& includes) const
{
includes.insert("simplescalarfilter.h");
stringstream ss;
ss << "SimpleScalarFilter(std::vector<SRCP>{";
if (!fCols.empty())
{
for (size_t i = 0; i < fCols.size() - 1; i++)
ss << "boost::shared_ptr<ReturnedColumn>(new " << fCols.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fCols.back()->toCppCode(includes) << ")";
}
ss << "}, ";
ss << "boost::shared_ptr<Operator>(new " << fOp->toCppCode(includes)
<< "), boost::make_shared<CalpontSelectExecutionPlan>())";
return ss.str();
}
ostream& operator<<(ostream& output, const SimpleScalarFilter& rhs)
{
output << rhs.toString();

View File

@ -60,7 +60,7 @@ class SimpleScalarFilter : public Filter
* pass all parts in ctor
* @note SimpleFilter takes ownership of all these pointers
*/
SimpleScalarFilter(const std::vector<SRCP>& cols, const SOP& op, SCSEP& sub);
SimpleScalarFilter(const std::vector<SRCP>& cols, const SOP& op, const SCSEP& sub);
/**
* Destructors
@ -100,13 +100,13 @@ class SimpleScalarFilter : public Filter
fSub = sub;
}
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual inline const std::string data() const
virtual inline const std::string data() const override
{
return fData;
}
virtual inline void data(const std::string data)
virtual inline void data(const std::string data) override
{
fData = data;
}
@ -114,14 +114,14 @@ class SimpleScalarFilter : public Filter
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
inline virtual SimpleScalarFilter* clone() const
inline virtual SimpleScalarFilter* clone() const override
{
return new SimpleScalarFilter(*this);
}
@ -131,7 +131,7 @@ class SimpleScalarFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -145,7 +145,7 @@ class SimpleScalarFilter : public Filter
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -154,6 +154,8 @@ class SimpleScalarFilter : public Filter
*/
bool operator!=(const SimpleScalarFilter& t) const;
virtual string toCppCode(IncludeSet& includes) const override;
private:
// default okay?
// SelectFilter& operator=(const SelectFilter& rhs);

View File

@ -22,10 +22,13 @@
#pragma once
#include <ostream>
#include <string>
#include <iostream>
#include <cmath>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <unordered_set>
#include <stdlib.h>
#include <unistd.h>
@ -56,6 +59,7 @@ namespace execplan
typedef execplan::CalpontSystemCatalog::ColType Type;
typedef datatypes::Decimal IDB_Decimal;
using IncludeSet = std::unordered_set<std::string>;
/**
* @brief IDB_Regex struct
*
@ -209,6 +213,7 @@ class TreeNode
*/
virtual bool operator!=(const TreeNode* t) const = 0;
virtual std::string toCppCode(IncludeSet& includes) const = 0;
// derivedTable mutator and accessor
virtual const std::string& derivedTable() const
{

View File

@ -64,7 +64,17 @@ const string TreeNodeImpl::toString() const
return string(">TreeNodeImpl<");
}
bool TreeNodeImpl::operator==(const TreeNodeImpl& t) const
std::string TreeNodeImpl::toCppCode(IncludeSet& includes) const
{
includes.insert("treenodeimpl.h");
stringstream ss;
ss << "TreeNodeImpl(" << std::quoted(fData) << ")";
return ss.str();
}
bool TreeNodeImpl::operator==(const TreeNodeImpl& t) const
{
if (data() == t.data())
return true;

View File

@ -65,13 +65,13 @@ class TreeNodeImpl : public TreeNode
/**
* Operations
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
virtual const std::string data() const
virtual const std::string data() const override
{
return fData;
}
virtual void data(const std::string data)
virtual void data(const std::string data) override
{
fData = data;
}
@ -80,7 +80,7 @@ class TreeNodeImpl : public TreeNode
*
* deep copy of this pointer and return the copy
*/
inline virtual TreeNodeImpl* clone() const
inline virtual TreeNodeImpl* clone() const override
{
return new TreeNodeImpl(*this);
}
@ -88,15 +88,15 @@ class TreeNodeImpl : public TreeNode
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -110,7 +110,7 @@ class TreeNodeImpl : public TreeNode
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -119,6 +119,7 @@ class TreeNodeImpl : public TreeNode
*/
bool operator!=(const TreeNodeImpl& t) const;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
// default okay
// TreeNodeImpl& operator=(const TreeNodeImpl& rhs);

View File

@ -74,6 +74,15 @@ const string UDAFColumn::toString() const
return output.str();
}
string UDAFColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("udafcolumn.h");
stringstream ss;
ss << "UDAFColumn(" << sessionID() << ")";
return ss.str();
}
ostream& operator<<(ostream& output, const UDAFColumn& rhs)
{
output << rhs.toString();

View File

@ -60,13 +60,13 @@ class UDAFColumn : public AggregateColumn
/**
* Overloaded stream operator
*/
virtual const std::string toString() const;
virtual const std::string toString() const override;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
virtual UDAFColumn* clone() const
virtual UDAFColumn* clone() const override
{
return new UDAFColumn(*this);
}
@ -82,8 +82,8 @@ class UDAFColumn : public AggregateColumn
/**
* Serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -91,7 +91,7 @@ class UDAFColumn : public AggregateColumn
* @return true iff every member of t is a duplicate copy of every member of this;
* false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
virtual bool operator==(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -108,7 +108,7 @@ class UDAFColumn : public AggregateColumn
* @return false iff every member of t is a duplicate copy of every member of this;
* true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
virtual bool operator!=(const TreeNode* t) const override;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
@ -119,6 +119,8 @@ class UDAFColumn : public AggregateColumn
using AggregateColumn::operator!=;
virtual bool operator!=(const UDAFColumn& t) const;
virtual std::string toCppCode(IncludeSet& includes) const override;
private:
mcsv1sdk::mcsv1Context context;
};

View File

@ -22,6 +22,7 @@
*
***********************************************************************/
#include <cstddef>
#include <string>
#include <iostream>
#include <sstream>
@ -52,7 +53,6 @@ using namespace rowgroup;
#include "joblisttypes.h"
using namespace joblist;
namespace execplan
{
void getWindowFunctionCols(execplan::ParseTree* n, void* obj)
@ -233,7 +233,17 @@ WindowFunctionColumn::WindowFunctionColumn(const WindowFunctionColumn& rhs, cons
, fTimeZone(rhs.timeZone())
{
}
WindowFunctionColumn::WindowFunctionColumn(const std::string& functionName,
const std::vector<SRCP>& functionParms,
const std::vector<SRCP>& partitions, WF_OrderBy& orderby,
const uint32_t sessionID)
: ReturnedColumn(sessionID)
, fFunctionName(functionName)
, fFunctionParms(functionParms)
, fPartitions(partitions)
, fOrderBy(orderby)
{
}
const string WindowFunctionColumn::toString() const
{
ostringstream output;
@ -267,6 +277,35 @@ const string WindowFunctionColumn::toString() const
return output.str();
}
string WindowFunctionColumn::toCppCode(IncludeSet& includes) const
{
includes.insert("windowfunctioncolumn.h");
stringstream ss;
ss << "WindowFunctionColumn(" << std::quoted(fFunctionName) << ", std::vector<SRCP>{";
if (!fFunctionParms.empty())
{
for (size_t i = 0; i < fFunctionParms.size() - 1; i++)
ss << "boost::shared_ptr<ReturnedColumn>(new " << fFunctionParms.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fFunctionParms.back()->toCppCode(includes) << ")";
}
ss << "}, std::vector<SRCP>{";
if (!fPartitions.empty())
{
for (size_t i = 0; i < fPartitions.size() - 1; i++)
ss << "boost::shared_ptr<ReturnedColumn>(new " << fPartitions.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fPartitions.back()->toCppCode(includes) << ")";
}
ss << "}, WF_OrderBy(std::vector<SRCP>{";
if (!fOrderBy.fOrders.empty())
{
for (size_t i = 0; i < fOrderBy.fOrders.size() - 1; i++)
ss << "boost::shared_ptr<ReturnedColumn>(new " << fOrderBy.fOrders.at(i)->toCppCode(includes) << "), ";
ss << "boost::shared_ptr<ReturnedColumn>(new " << fOrderBy.fOrders.back()->toCppCode(includes) << ")}))";
}
return ss.str();
}
void WindowFunctionColumn::serialize(messageqcpp::ByteStream& b) const
{
b << (ObjectReader::id_t)ObjectReader::WINDOWFUNCTIONCOLUMN;

View File

@ -55,6 +55,9 @@ class WindowFunctionColumn : public ReturnedColumn
public:
WindowFunctionColumn();
WindowFunctionColumn(const std::string& functionName, const uint32_t sessionID = 0);
WindowFunctionColumn(const std::string& functionName, const std::vector<SRCP>& functionParms,
const std::vector<SRCP>& partitions, WF_OrderBy& orderby,
const uint32_t sessionID = 0);
WindowFunctionColumn(const WindowFunctionColumn& rhs, const uint32_t sessionID = 0);
virtual ~WindowFunctionColumn()
{
@ -109,7 +112,7 @@ class WindowFunctionColumn : public ReturnedColumn
}
/** make a clone of this window function */
inline virtual WindowFunctionColumn* clone() const
inline virtual WindowFunctionColumn* clone() const override
{
return new WindowFunctionColumn(*this);
}
@ -117,23 +120,24 @@ class WindowFunctionColumn : public ReturnedColumn
std::vector<SRCP> getColumnList() const;
/** output the function for debug purpose */
const std::string toString() const;
const std::string toString() const override;
virtual std::string toCppCode(IncludeSet& includes) const override;
/**
* The serialization interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
virtual void serialize(messageqcpp::ByteStream&) const override;
virtual void unserialize(messageqcpp::ByteStream&) override;
// util function for connector to use.
void addToPartition(std::vector<SRCP>& groupByList);
using ReturnedColumn::hasAggregate;
virtual bool hasAggregate()
virtual bool hasAggregate() override
{
return false;
}
virtual bool hasWindowFunc();
virtual bool hasWindowFunc() override;
void adjustResultType();
// UDAnF support
@ -166,12 +170,12 @@ class WindowFunctionColumn : public ReturnedColumn
WF_OrderBy fOrderBy; /// order by clause
// not support for window functions for now.
virtual bool operator==(const TreeNode* t) const
virtual bool operator==(const TreeNode* t) const override
{
return false;
}
bool operator==(const WindowFunctionColumn& t) const;
virtual bool operator!=(const TreeNode* t) const
virtual bool operator!=(const TreeNode* t) const override
{
return false;
}
@ -185,70 +189,70 @@ class WindowFunctionColumn : public ReturnedColumn
* F&E framework *
***********************************************************/
public:
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getStrVal(fTimeZone);
}
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getIntVal();
}
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getUintVal();
}
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getFloatVal();
}
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDoubleVal();
}
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getLongDoubleVal();
}
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDecimalVal();
}
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDateIntVal();
}
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getDatetimeIntVal();
}
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimestampIntVal();
}
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
{
evaluate(row, isNull);
return TreeNode::getTimeIntVal();
}
private:
void evaluate(rowgroup::Row& row, bool& isNull);
void evaluate(rowgroup::Row& row, bool& isNull) override;
};
/**

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,11 +13,8 @@
#include "rewrites.h"
#include "bytestream.h"
#include "objectreader.h"
#include "unitqueries_before.h"
#include "unitqueries_after.h"
#include "query19_init.h"
#include "query19_fixed.h"
#include "unitqueries_tree_before.h"
#include "unitqueries_tree_after.h"
using TreePtr = std::unique_ptr<execplan::ParseTree>;
@ -62,8 +59,8 @@ void printTree(const std::string& queryName, execplan::ParseTree* tree, const st
struct ParseTreeTestParam
{
std::string queryName;
std::vector<unsigned char>* query = nullptr;
std::vector<unsigned char>* manually_rewritten_query = nullptr;
execplan::ParseTree* query = nullptr;
execplan::ParseTree* manually_rewritten_query = nullptr;
friend std::ostream& operator<<(std::ostream& os, const ParseTreeTestParam& bar)
{
@ -75,24 +72,19 @@ class ParseTreeTest : public testing::TestWithParam<::ParseTreeTestParam> {};
TEST_P(ParseTreeTest, Rewrite)
{
messageqcpp::ByteStream stream;
stream.load(GetParam().query->data(), GetParam().query->size());
execplan::ParseTree* initialTree = execplan::ObjectReader::createParseTree(stream);
execplan::ParseTree* initialTree = GetParam().query;
printTree(GetParam().queryName, initialTree, "initial");
TreePtr rewrittenTree;
rewrittenTree.reset(execplan::extractCommonLeafConjunctionsToRoot<true>(initialTree));
if (GetParam().manually_rewritten_query)
{
stream.load(GetParam().manually_rewritten_query->data(), GetParam().manually_rewritten_query->size());
TreePtr manuallyRewrittenTree;
manuallyRewrittenTree.reset(execplan::ObjectReader::createParseTree(stream));
manuallyRewrittenTree.reset(GetParam().manually_rewritten_query);
bool result = treeEqual(manuallyRewrittenTree.get(), rewrittenTree.get());
printTree(GetParam().queryName, rewrittenTree.get(), "rewritten");
printTree(GetParam().queryName, manuallyRewrittenTree.get(), "reference");
EXPECT_TRUE(result);
}
else
@ -119,7 +111,7 @@ INSTANTIATE_TEST_SUITE_P(TreeRewrites, ParseTreeTest, testing::Values(
);
*/
ParseTreeTestParam{"Query_1", &__test_query_before_1, &__test_query_after_1},
ParseTreeTestParam{"Query_1", execplan::initial_Query_1, execplan::reference_Query_1},
/*
select t1.posname, t2.posname
@ -128,7 +120,7 @@ INSTANTIATE_TEST_SUITE_P(TreeRewrites, ParseTreeTest, testing::Values(
t1.id = t2.id
and (t1.pos + t2.pos < 1000);
*/
ParseTreeTestParam{"Query_2", &__test_query_before_2},
ParseTreeTestParam{"Query_2", execplan::initial_Query_2},
/*
select t1.posname, t2.posname
@ -141,7 +133,7 @@ INSTANTIATE_TEST_SUITE_P(TreeRewrites, ParseTreeTest, testing::Values(
(t1.posname < dcba);
*/
ParseTreeTestParam{"Query_3", &__test_query_before_3},
ParseTreeTestParam{"Query_3", execplan::initial_Query_3},
/*
select t1.posname, t2.posname
@ -153,7 +145,7 @@ or
*/
ParseTreeTestParam{"Query_4", &__test_query_before_4},
ParseTreeTestParam{"Query_4", execplan::initial_Query_4},
/*select t1.posname, t2.posname from t1,t2
where
@ -167,7 +159,7 @@ t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_5", &__test_query_before_5},
ParseTreeTestParam{"Query_5", execplan::initial_Query_5},
/*select t1.posname, t2.posname from t1,t2
where
@ -181,7 +173,7 @@ t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_6", &__test_query_before_6},
ParseTreeTestParam{"Query_6", execplan::initial_Query_6},
/*
select t1.posname
@ -197,7 +189,7 @@ id < 30
);
*/
ParseTreeTestParam{"Query_7", &__test_query_before_7},
ParseTreeTestParam{"Query_7", execplan::initial_Query_7},
/*select t1.posname, t2.posname
from t1,t2
@ -210,7 +202,7 @@ and id < 30
)
and t1.id = t2.id;
*/
ParseTreeTestParam{"Query_8", &__test_query_before_8},
ParseTreeTestParam{"Query_8", execplan::initial_Query_8},
/*select t1.posname, t2.posname
from t1,t2
@ -226,7 +218,7 @@ t1.id = t2.id
and t1.id = t2.rid
);
*/
ParseTreeTestParam{"Query_9", &__test_query_before_9},
ParseTreeTestParam{"Query_9", execplan::initial_Query_9},
/*select * from t1
where
@ -240,7 +232,7 @@ pos > 5000
and place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_10", &__test_query_before_10},
ParseTreeTestParam{"Query_10", execplan::initial_Query_10},
/*select *
from t1
@ -255,7 +247,7 @@ pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_11", &__test_query_before_11, &__test_query_after_11},
ParseTreeTestParam{"Query_11", execplan::initial_Query_11, execplan::reference_Query_11},
/*select *
from t1
@ -270,7 +262,7 @@ pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_12", &__test_query_before_12},
ParseTreeTestParam{"Query_12", execplan::initial_Query_12},
/*select *
from t1
@ -285,7 +277,7 @@ pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_13", &__test_query_before_13},
ParseTreeTestParam{"Query_13", execplan::initial_Query_13},
/*select *
from t1
@ -305,7 +297,7 @@ pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_14", &__test_query_before_14},
ParseTreeTestParam{"Query_14", execplan::initial_Query_14},
/*select *
from t1
@ -332,7 +324,7 @@ and
pos > 5000
or id < 30);
*/
ParseTreeTestParam{"Query_15", &__test_query_before_15, &__test_query_after_15},
ParseTreeTestParam{"Query_15", execplan::initial_Query_15, execplan::reference_Query_15},
/*
select *
from t1
@ -352,7 +344,7 @@ pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_16", &__test_query_before_16, &__test_query_after_16},
ParseTreeTestParam{"Query_16", execplan::initial_Query_16, execplan::reference_Query_16},
/*
select *
from t1
@ -377,7 +369,7 @@ pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_17", &__test_query_before_17, &__test_query_after_17},
ParseTreeTestParam{"Query_17", execplan::initial_Query_17, execplan::reference_Query_17},
/*
select *
from t1
@ -407,7 +399,7 @@ pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_18", &__test_query_before_18, &__test_query_after_18},
ParseTreeTestParam{"Query_18", execplan::initial_Query_18, execplan::reference_Query_18},
/*
select *
from t1
@ -453,7 +445,7 @@ and id < 30
);
*/
ParseTreeTestParam{"Query_19", &__test_query_before_19, &__test_query_after_19},
ParseTreeTestParam{"Query_19", execplan::initial_Query_19, execplan::reference_Query_19},
/*
select *
from t1
@ -472,7 +464,7 @@ place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_20", &__test_query_before_20, &__test_query_after_20},
ParseTreeTestParam{"Query_20", execplan::initial_Query_20, execplan::reference_Query_20},
/*
select *
from t1
@ -497,7 +489,7 @@ place < 'zyxqwertyu'
);
*/
ParseTreeTestParam{"Query_21", &__test_query_before_21, &__test_query_after_21},
ParseTreeTestParam{"Query_21", execplan::initial_Query_21, execplan::reference_Query_21},
/*
select *
from t1
@ -511,7 +503,7 @@ or
(pos > 5000 and id < 30);
*/
ParseTreeTestParam{"Query_22", &__test_query_before_22, &__test_query_after_22},
ParseTreeTestParam{"Query_22", execplan::initial_Query_22, execplan::reference_Query_22},
/*
select *
@ -526,7 +518,7 @@ or
(pos > 5000 and id < 30);
*/
ParseTreeTestParam{"Query_23", &__test_query_before_23, &__test_query_after_23},
ParseTreeTestParam{"Query_23", execplan::initial_Query_23, execplan::reference_Query_23},
/*
select *
from t1
@ -542,7 +534,7 @@ or
(pos > 5000 and id < 30 and place < 'zyxqwertyu' and rid > 20);
*/
ParseTreeTestParam{"Query_27", &__test_query_before_27, &__test_query_after_27},
ParseTreeTestParam{"Query_27", execplan::initial_Query_27, execplan::reference_Query_27},
/*
select *
from t1
@ -556,8 +548,8 @@ or
(pos > 5000 and id < 30 and rid > 20 and place < 'zyxqwertyu' and place < 'zyxqwertyu');
*/
ParseTreeTestParam{"Query_28", &__test_query_before_28, &__test_query_after_28},
ParseTreeTestParam{"TPCH_19", &__query19_tree_init, &__query19_tree_fixed}
ParseTreeTestParam{"Query_28", execplan::initial_Query_28, execplan::reference_Query_28},
ParseTreeTestParam{"TPCH_19", execplan::initial_TPCH_19, execplan::reference_TPCH_19}
),
[](const ::testing::TestParamInfo<ParseTreeTest::ParamType>& info) {
return info.param.queryName;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,437 @@
#include "simplecolumn.h"
#include "constantfilter.h"
#include "simplefilter.h"
#include "logicoperator.h"
#include "parsetree.h"
#include "existsfilter.h"
namespace execplan
{
auto reference_Query_1 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`pos` + `test`.`t2`.`pos` > 15000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`pos` + `test`.`t2`.`pos` < 1000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr)),
new ParseTree(new SimpleFilter("`test`.`t1`.`id` = `test`.`t2`.`id`",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_11 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_15 = new ParseTree(
new LogicOperator("and"),
new ParseTree(new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`id` < 30",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`pos` > 5000",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new ExistsFilter(boost::shared_ptr<CalpontSelectExecutionPlan>(), 0, 1), nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_16 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_17 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_18 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_19 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr));
}
namespace execplan
{
auto reference_Query_20 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_Query_21 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_Query_22 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_Query_23 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(
new SimpleFilter("5000 < `test`.`t1`.`pos`", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_Query_27 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(
new SimpleFilter("`test`.`t1`.`rid` > 20", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`pos` > 5000", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_Query_28 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` > 'abcdefghij'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter("`test`.`t1`.`posname` > 'qwer'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`test`.`t1`.`rid` > 20",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`test`.`t1`.`pos` > 5000",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`test`.`t1`.`place` < 'zyxqwertyu'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`test`.`t1`.`id` < 30", SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}), nullptr,
nullptr));
}
namespace execplan
{
auto reference_TPCH_19 = new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(
new LogicOperator("or"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(new SimpleFilter(
"`tpch`.`PART`.`p_size` <= 15",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter(
"`tpch`.`LINEITEM`.`l_quantity` <= 30",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`tpch`.`LINEITEM`.`l_quantity` >= 20",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new ConstantFilter(
boost::shared_ptr<Operator>(new LogicOperator("or")),
ConstantFilter::FilterList{
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'LG PKG'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'LG PACK'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'LG BOX'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'LG CASE'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}))},
boost::shared_ptr<ReturnedColumn>(
new SimpleColumn("`tpch`.`PART`.`p_container`",
SimpleColumn::ForTestPurposeWithoutOID{})),
"",
"`tpch`.`PART`.`P_CONTAINER` in ('LG CASE','LG BOX','LG PACK','LG "
"PKG')"),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`tpch`.`PART`.`p_brand` = 'Brand#34'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(new SimpleFilter(
"`tpch`.`PART`.`p_size` <= 10",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(new SimpleFilter(
"`tpch`.`LINEITEM`.`l_quantity` <= 20",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`tpch`.`LINEITEM`.`l_quantity` >= 10",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new ConstantFilter(
boost::shared_ptr<Operator>(new LogicOperator("or")),
ConstantFilter::FilterList{
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'MED PACK'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'MED PKG'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'MED BOX'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'MED BAG'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}))},
boost::shared_ptr<ReturnedColumn>(
new SimpleColumn("`tpch`.`PART`.`p_container`",
SimpleColumn::ForTestPurposeWithoutOID{})),
"",
"`tpch`.`PART`.`P_CONTAINER` in ('MED BAG','MED BOX','MED PKG','MED "
"PACK')"),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`tpch`.`PART`.`p_brand` = 'Brand#23'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new LogicOperator("and"),
new ParseTree(
new SimpleFilter("`tpch`.`PART`.`p_size` <= 5",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr),
new ParseTree(
new SimpleFilter("`tpch`.`LINEITEM`.`l_quantity` <= 11",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new SimpleFilter("`tpch`.`LINEITEM`.`l_quantity` >= 1",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(
new ConstantFilter(
boost::shared_ptr<Operator>(new LogicOperator("or")),
ConstantFilter::FilterList{
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'SM PKG'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'SM PACK'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'SM BOX'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`PART`.`p_container` = 'SM CASE'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}))},
boost::shared_ptr<ReturnedColumn>(
new SimpleColumn("`tpch`.`PART`.`p_container`",
SimpleColumn::ForTestPurposeWithoutOID{})),
"",
"`tpch`.`PART`.`P_CONTAINER` in ('SM CASE','SM BOX','SM PACK','SM PKG')"),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`tpch`.`PART`.`p_brand` = 'Brand#12'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr))),
new ParseTree(new SimpleFilter("`tpch`.`PART`.`p_size` >= 1",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`tpch`.`PART`.`p_partkey` = `tpch`.`LINEITEM`.`l_partkey`",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new SimpleFilter("`tpch`.`LINEITEM`.`l_shipinstruct` = 'DELIVER IN PERSON'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}),
nullptr, nullptr)),
new ParseTree(new ConstantFilter(
boost::shared_ptr<Operator>(new LogicOperator("or")),
ConstantFilter::FilterList{boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`LINEITEM`.`l_shipmode` = 'AIR REG'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})),
boost::shared_ptr<SimpleFilter>(new SimpleFilter(
"`tpch`.`LINEITEM`.`l_shipmode` = 'AIR'",
SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}))},
boost::shared_ptr<ReturnedColumn>(new SimpleColumn(
"`tpch`.`LINEITEM`.`l_shipmode`", SimpleColumn::ForTestPurposeWithoutOID{})),
"", "`tpch`.`LINEITEM`.`L_SHIPMODE` in ('AIR','AIR REG')"),
nullptr, nullptr));
}

File diff suppressed because it is too large Load Diff