1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-4823 WHERE char_col<varchar_col returns a wrong result of a large table (#2060)

SCommand StrFilterCmd::duplicate() missed these two lines:

    filterCmd->leftColType = leftColType;
    filterCmd->rightColType = rightColType;

which exist in the parent's FilterCommand::duplicate().

Rewriting the code to avoid duplication by using more inherited
methods/constructors. This reduces the probability of similar bugs
in the future.
This commit is contained in:
Alexander Barkov
2021-08-03 12:53:05 +04:00
committed by GitHub
parent dffef34c78
commit c16b0f6ad7
10 changed files with 161 additions and 45 deletions

View File

@ -893,7 +893,7 @@ void ColumnCommand::duplicate(ColumnCommand* cc)
cc->lastLbid = lastLbid;
cc->r = r;
cc->rowSize = rowSize;
cc->Command::duplicate(this);
cc->Command::operator=(*this);
}
SCommand ColumnCommand::duplicate()

View File

@ -161,15 +161,4 @@ bool Command::operator==(const Command& c) const
return true;
}
void Command::duplicate(Command* c)
{
bpp = c->bpp;
cmdType = c->cmdType;
fFilterFeeder = c->fFilterFeeder;
OID = c->OID;
tupleKey = c->tupleKey;
queryUuid = c->queryUuid;
stepUuid = c->stepUuid;
}
}

View File

@ -117,12 +117,8 @@ protected:
boost::uuids::uuid queryUuid;
boost::uuids::uuid stepUuid;
void duplicate(Command*);
private:
Command();
Command(const Command&);
Command(const Command &rhs) = default;
Command & operator=(const Command & rhs) = default;
};
}

View File

@ -697,7 +697,7 @@ SCommand DictStep::duplicate()
ds->filterString = filterString;
ds->filterCount = filterCount;
ds->charsetNumber = charsetNumber;
ds->Command::duplicate(this);
ds->Command::operator=(*this);
return ret;
}

View File

@ -233,16 +233,7 @@ void FilterCommand::nextLBID()
SCommand FilterCommand::duplicate()
{
SCommand ret;
FilterCommand* filterCmd;
ret.reset(new FilterCommand());
filterCmd = (FilterCommand*) ret.get();
filterCmd->fBOP = fBOP;
filterCmd->leftColType = leftColType;
filterCmd->rightColType = rightColType;
filterCmd->Command::duplicate(this);
return ret;
return SCommand(new FilterCommand(*this));
}
@ -516,16 +507,7 @@ StrFilterCmd::~StrFilterCmd()
SCommand StrFilterCmd::duplicate()
{
SCommand ret;
StrFilterCmd* filterCmd;
ret.reset(new StrFilterCmd());
filterCmd = (StrFilterCmd*) ret.get();
filterCmd->fBOP = fBOP;
filterCmd->fCompare = fCompare;
filterCmd->fCharLength = fCharLength;
return ret;
return SCommand(new StrFilterCmd(*this));
}

View File

@ -88,9 +88,10 @@ protected:
execplan::CalpontSystemCatalog::ColType leftColType;
execplan::CalpontSystemCatalog::ColType rightColType;
FilterCommand(const FilterCommand&rhs) = default;
private:
// disabled copy constructor and operator
FilterCommand(const FilterCommand&);
// disabled copy operator
FilterCommand& operator=(const FilterCommand&);
};
@ -156,9 +157,10 @@ protected:
// colWidth of columns the don't need a dictionary
size_t fCharLength;
StrFilterCmd(const StrFilterCmd &rhs) = default;
private:
// disabled copy constructor and operator
StrFilterCmd(const StrFilterCmd&);
// disabled copy operator
StrFilterCmd& operator=(const StrFilterCmd&);
};

View File

@ -191,7 +191,7 @@ SCommand PassThruCommand::duplicate()
ret.reset(new PassThruCommand());
p = (PassThruCommand*) ret.get();
p->colWidth = colWidth;
p->Command::duplicate(this);
p->Command::operator=(*this);
return ret;
}

View File

@ -205,7 +205,7 @@ SCommand RTSCommand::duplicate()
rts->col.reset(ColumnCommandFabric::duplicate(col));
rts->dict = dict;
rts->Command::duplicate(this);
rts->Command::operator=(*this);
return ret;
}