1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-18 13:54:11 +03:00

Merge pull request #190 from mariadb-corporation/MCOL-730-1.0

MCOL-730 Fix decimals in cross engine join
This commit is contained in:
David.Hall
2017-06-02 09:40:19 -05:00
committed by GitHub
2 changed files with 20 additions and 11 deletions

View File

@@ -247,7 +247,7 @@ void CrossEngineStep::makeMappings()
}
void CrossEngineStep::setField(int i, const char* value, Row& row)
void CrossEngineStep::setField(int i, const char* value, drizzle_column_st* field, Row& row)
{
CalpontSystemCatalog::ColDataType colType = row.getColType(i);
@@ -264,8 +264,16 @@ void CrossEngineStep::setField(int i, const char* value, Row& row)
CalpontSystemCatalog::ColType ct;
ct.colDataType = colType;
ct.colWidth = row.getColumnWidth(i);
if (colType == CalpontSystemCatalog::DECIMAL)
{
ct.scale = field->decimals;
ct.precision = field->size;
}
else
{
ct.scale = row.getScale(i);
ct.precision = row.getPrecision(i);
}
row.setIntField(convertValueNum(value, ct, row.getSignedNullValue(i)), i);
}
}
@@ -500,7 +508,7 @@ void CrossEngineStep::execute()
while ((rowIn = drizzle->nextRow()) && !cancelled())
{
for(int i = 0; i < num_fields; i++)
setField(i, rowIn[i], fRowDelivered);
setField(i, rowIn[i], drizzle->getField(i), fRowDelivered);
addRow(rgDataDelivered);
}
@@ -520,7 +528,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++)
{
if (fFe1Column[i] != -1)
setField(fFe1Column[i], rowIn[i], rowFe1);
setField(fFe1Column[i], rowIn[i], drizzle->getField(i), rowFe1);
}
if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false)
@@ -534,7 +542,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++)
{
if (fFe1Column[i] == -1)
setField(i, rowIn[i], fRowDelivered);
setField(i, rowIn[i], drizzle->getField(i), fRowDelivered);
}
addRow(rgDataDelivered);
@@ -552,7 +560,7 @@ void CrossEngineStep::execute()
while ((rowIn = drizzle->nextRow()) && !cancelled())
{
for(int i = 0; i < num_fields; i++)
setField(i, rowIn[i], rowFe3);
setField(i, rowIn[i], drizzle->getField(i), rowFe3);
fFeInstance->evaluate(rowFe3, fFeSelects);
fFeInstance->evaluate(rowFe3, fFeSelects);
@@ -583,7 +591,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++)
{
if (fFe1Column[i] != -1)
setField(fFe1Column[i], rowIn[i], rowFe1);
setField(fFe1Column[i], rowIn[i], drizzle->getField(i), rowFe1);
}
if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false)
@@ -597,7 +605,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++)
{
if (fFe1Column[i] == -1)
setField(i, rowIn[i], rowFe3);
setField(i, rowIn[i], drizzle->getField(i), rowFe3);
}
fFeInstance->evaluate(rowFe3, fFeSelects);

View File

@@ -60,6 +60,7 @@ public:
int getRowCount() { return drizzle_result_row_count(fDrzrp); }
char** nextRow() { return drizzle_row_next(fDrzrp); }
const string& getError() { return fErrStr; }
drizzle_column_st* getField(int field) { return drizzle_column_index(fDrzrp, field); }
private:
drizzle_st* fDrzp;
@@ -149,7 +150,7 @@ protected:
virtual void makeMappings();
virtual void addFilterStr(const std::vector<const execplan::Filter*>&, const std::string&);
virtual std::string makeQuery();
virtual void setField(int, const char*, rowgroup::Row&);
virtual void setField(int, const char*, drizzle_column_st*, rowgroup::Row&);
inline void addRow(rowgroup::RGData &);
//inline void addRow(boost::shared_array<uint8_t>&);
virtual int64_t convertValueNum(