You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2026-01-06 08:21:10 +03:00
MCOL-1201 manual rebase with develop. Obsoletes branch MCOL-1201
This commit is contained in:
@@ -98,36 +98,6 @@ AggregateColumn::AggregateColumn(const uint32_t sessionID):
|
||||
{
|
||||
}
|
||||
|
||||
AggregateColumn::AggregateColumn(const AggOp aggOp, ReturnedColumn* parm, const uint32_t sessionID):
|
||||
ReturnedColumn(sessionID),
|
||||
fAggOp(aggOp),
|
||||
fAsc(false),
|
||||
fData(aggOp + "(" + parm->data() + ")")
|
||||
{
|
||||
fFunctionParms.reset(parm);
|
||||
}
|
||||
|
||||
AggregateColumn::AggregateColumn(const AggOp aggOp, const string& content, const uint32_t sessionID):
|
||||
ReturnedColumn(sessionID),
|
||||
fAggOp(aggOp),
|
||||
fAsc(false),
|
||||
fData(aggOp + "(" + content + ")")
|
||||
{
|
||||
// TODO: need to handle distinct
|
||||
fFunctionParms.reset(new ArithmeticColumn(content));
|
||||
}
|
||||
|
||||
// deprecated constructor. use function name as string
|
||||
AggregateColumn::AggregateColumn(const std::string& functionName, ReturnedColumn* parm, const uint32_t sessionID):
|
||||
ReturnedColumn(sessionID),
|
||||
fFunctionName(functionName),
|
||||
fAggOp(NOOP),
|
||||
fAsc(false),
|
||||
fData(functionName + "(" + parm->data() + ")")
|
||||
{
|
||||
fFunctionParms.reset(parm);
|
||||
}
|
||||
|
||||
// deprecated constructor. use function name as string
|
||||
AggregateColumn::AggregateColumn(const string& functionName, const string& content, const uint32_t sessionID):
|
||||
ReturnedColumn(sessionID),
|
||||
@@ -137,20 +107,21 @@ AggregateColumn::AggregateColumn(const string& functionName, const string& conte
|
||||
fData(functionName + "(" + content + ")")
|
||||
{
|
||||
// TODO: need to handle distinct
|
||||
fFunctionParms.reset(new ArithmeticColumn(content));
|
||||
SRCP srcp(new ArithmeticColumn(content));
|
||||
fAggParms.push_back(srcp);
|
||||
}
|
||||
|
||||
AggregateColumn::AggregateColumn( const AggregateColumn& rhs, const uint32_t sessionID ):
|
||||
ReturnedColumn(rhs, sessionID),
|
||||
fFunctionName (rhs.fFunctionName),
|
||||
fAggOp(rhs.fAggOp),
|
||||
fFunctionParms(rhs.fFunctionParms),
|
||||
fTableAlias(rhs.tableAlias()),
|
||||
fAsc(rhs.asc()),
|
||||
fData(rhs.data()),
|
||||
fConstCol(rhs.fConstCol)
|
||||
{
|
||||
fAlias = rhs.alias();
|
||||
fAggParms = rhs.fAggParms;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,10 +137,14 @@ const string AggregateColumn::toString() const
|
||||
|
||||
if (fAlias.length() > 0) output << "/Alias: " << fAlias << endl;
|
||||
|
||||
if (fFunctionParms == 0)
|
||||
output << "No arguments" << endl;
|
||||
if (fAggParms.size() == 0)
|
||||
output << "No arguments";
|
||||
else
|
||||
output << *fFunctionParms << endl;
|
||||
for (uint32_t i = 0; i < fAggParms.size(); ++i)
|
||||
{
|
||||
output << *(fAggParms[i]) << " ";
|
||||
}
|
||||
output << endl;
|
||||
|
||||
if (fConstCol)
|
||||
output << *fConstCol;
|
||||
@@ -191,10 +166,11 @@ void AggregateColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
b << fFunctionName;
|
||||
b << static_cast<uint8_t>(fAggOp);
|
||||
|
||||
if (fFunctionParms == 0)
|
||||
b << (uint8_t) ObjectReader::NULL_CLASS;
|
||||
else
|
||||
fFunctionParms->serialize(b);
|
||||
b << static_cast<uint32_t>(fAggParms.size());
|
||||
for (uint32_t i = 0; i < fAggParms.size(); ++i)
|
||||
{
|
||||
fAggParms[i]->serialize(b);
|
||||
}
|
||||
|
||||
b << static_cast<uint32_t>(fGroupByColList.size());
|
||||
|
||||
@@ -219,20 +195,26 @@ void AggregateColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
|
||||
void AggregateColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
{
|
||||
ObjectReader::checkType(b, ObjectReader::AGGREGATECOLUMN);
|
||||
fGroupByColList.erase(fGroupByColList.begin(), fGroupByColList.end());
|
||||
fProjectColList.erase(fProjectColList.begin(), fProjectColList.end());
|
||||
ReturnedColumn::unserialize(b);
|
||||
b >> fFunctionName;
|
||||
b >> fAggOp;
|
||||
//delete fFunctionParms;
|
||||
fFunctionParms.reset(
|
||||
dynamic_cast<ReturnedColumn*>(ObjectReader::createTreeNode(b)));
|
||||
|
||||
messageqcpp::ByteStream::quadbyte size;
|
||||
messageqcpp::ByteStream::quadbyte i;
|
||||
ReturnedColumn* rc;
|
||||
|
||||
ObjectReader::checkType(b, ObjectReader::AGGREGATECOLUMN);
|
||||
fGroupByColList.erase(fGroupByColList.begin(), fGroupByColList.end());
|
||||
fProjectColList.erase(fProjectColList.begin(), fProjectColList.end());
|
||||
fAggParms.erase(fAggParms.begin(), fAggParms.end());
|
||||
ReturnedColumn::unserialize(b);
|
||||
b >> fFunctionName;
|
||||
b >> fAggOp;
|
||||
|
||||
b >> size;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
rc = dynamic_cast<ReturnedColumn*>(ObjectReader::createTreeNode(b));
|
||||
SRCP srcp(rc);
|
||||
fAggParms.push_back(srcp);
|
||||
}
|
||||
|
||||
b >> size;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
@@ -261,6 +243,7 @@ void AggregateColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
bool AggregateColumn::operator==(const AggregateColumn& t) const
|
||||
{
|
||||
const ReturnedColumn* rc1, *rc2;
|
||||
AggParms::const_iterator it, it2;
|
||||
|
||||
rc1 = static_cast<const ReturnedColumn*>(this);
|
||||
rc2 = static_cast<const ReturnedColumn*>(&t);
|
||||
@@ -277,16 +260,18 @@ bool AggregateColumn::operator==(const AggregateColumn& t) const
|
||||
if (fAggOp != t.fAggOp)
|
||||
return false;
|
||||
|
||||
if (fFunctionParms.get() != NULL && t.fFunctionParms.get() != NULL)
|
||||
if (aggParms().size() != t.aggParms().size())
|
||||
{
|
||||
if (*fFunctionParms.get() != t.fFunctionParms.get())
|
||||
return false;
|
||||
}
|
||||
for (it = fAggParms.begin(), it2 = t.fAggParms.begin();
|
||||
it != fAggParms.end();
|
||||
++it, ++it2)
|
||||
{
|
||||
if (**it != **it2)
|
||||
return false;
|
||||
}
|
||||
else if (fFunctionParms.get() != NULL || t.fFunctionParms.get() != NULL)
|
||||
return false;
|
||||
|
||||
//if (fAlias != t.fAlias)
|
||||
// return false;
|
||||
if (fTableAlias != t.fTableAlias)
|
||||
return false;
|
||||
|
||||
@@ -645,3 +630,4 @@ AggregateColumn::AggOp AggregateColumn::agname2num(const string& agname)
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
|
||||
|
||||
Reference in New Issue
Block a user