1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-11-05 04:50:35 +03:00
This commit is contained in:
david hill
2017-06-02 11:02:09 -05:00
2 changed files with 21 additions and 10 deletions

View File

@@ -231,7 +231,7 @@ void CrossEngineStep::makeMappings()
} }
void CrossEngineStep::setField(int i, const char* value, unsigned long length, Row& row) void CrossEngineStep::setField(int i, const char* value, unsigned long length, MYSQL_FIELD* field, Row& row)
{ {
CalpontSystemCatalog::ColDataType colType = row.getColType(i); CalpontSystemCatalog::ColDataType colType = row.getColType(i);
@@ -257,8 +257,16 @@ void CrossEngineStep::setField(int i, const char* value, unsigned long length, R
CalpontSystemCatalog::ColType ct; CalpontSystemCatalog::ColType ct;
ct.colDataType = colType; ct.colDataType = colType;
ct.colWidth = row.getColumnWidth(i); ct.colWidth = row.getColumnWidth(i);
if (colType == CalpontSystemCatalog::DECIMAL)
{
ct.scale = field->decimals;
ct.precision = field->length;
}
else
{
ct.scale = row.getScale(i); ct.scale = row.getScale(i);
ct.precision = row.getPrecision(i); ct.precision = row.getPrecision(i);
}
row.setIntField(convertValueNum(value, ct, row.getSignedNullValue(i)), i); row.setIntField(convertValueNum(value, ct, row.getSignedNullValue(i)), i);
} }
} }
@@ -494,7 +502,7 @@ void CrossEngineStep::execute()
while ((rowIn = mysql->nextRow()) && !cancelled()) while ((rowIn = mysql->nextRow()) && !cancelled())
{ {
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
setField(i, rowIn[i], mysql->getFieldLength(i), fRowDelivered); setField(i, rowIn[i], mysql->getFieldLength(i), mysql->getField(i), fRowDelivered);
addRow(rgDataDelivered); addRow(rgDataDelivered);
} }
@@ -514,7 +522,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
{ {
if (fFe1Column[i] != -1) if (fFe1Column[i] != -1)
setField(fFe1Column[i], rowIn[i], mysql->getFieldLength(i), rowFe1); setField(fFe1Column[i], rowIn[i], mysql->getFieldLength(i), mysql->getField(i), rowFe1);
} }
if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false) if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false)
@@ -528,7 +536,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
{ {
if (fFe1Column[i] == -1) if (fFe1Column[i] == -1)
setField(i, rowIn[i], mysql->getFieldLength(i), fRowDelivered); setField(i, rowIn[i], mysql->getFieldLength(i), mysql->getField(i), fRowDelivered);
} }
addRow(rgDataDelivered); addRow(rgDataDelivered);
@@ -546,7 +554,7 @@ void CrossEngineStep::execute()
while ((rowIn = mysql->nextRow()) && !cancelled()) while ((rowIn = mysql->nextRow()) && !cancelled())
{ {
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
setField(i, rowIn[i], mysql->getFieldLength(i), rowFe3); setField(i, rowIn[i], mysql->getFieldLength(i), mysql->getField(i), rowFe3);
fFeInstance->evaluate(rowFe3, fFeSelects); fFeInstance->evaluate(rowFe3, fFeSelects);
fFeInstance->evaluate(rowFe3, fFeSelects); fFeInstance->evaluate(rowFe3, fFeSelects);
@@ -577,7 +585,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
{ {
if (fFe1Column[i] != -1) if (fFe1Column[i] != -1)
setField(fFe1Column[i], rowIn[i], mysql->getFieldLength(i), rowFe1); setField(fFe1Column[i], rowIn[i], mysql->getFieldLength(i), mysql->getField(i), rowFe1);
} }
if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false) if (fFeFilters && fFeInstance->evaluate(rowFe1, fFeFilters.get()) == false)
@@ -591,7 +599,7 @@ void CrossEngineStep::execute()
for(int i = 0; i < num_fields; i++) for(int i = 0; i < num_fields; i++)
{ {
if (fFe1Column[i] == -1) if (fFe1Column[i] == -1)
setField(i, rowIn[i], mysql->getFieldLength(i), rowFe3); setField(i, rowIn[i], mysql->getFieldLength(i), mysql->getField(i), rowFe3);
} }
fFeInstance->evaluate(rowFe3, fFeSelects); fFeInstance->evaluate(rowFe3, fFeSelects);

View File

@@ -64,14 +64,17 @@ public:
{ {
char** row = mysql_fetch_row(fRes); char** row = mysql_fetch_row(fRes);
fieldLengths = mysql_fetch_lengths(fRes); fieldLengths = mysql_fetch_lengths(fRes);
fFields = mysql_fetch_fields(fRes);
return row; return row;
} }
long getFieldLength(int field) { return fieldLengths[field]; } long getFieldLength(int field) { return fieldLengths[field]; }
MYSQL_FIELD* getField(int field) { return &fFields[field]; }
const std::string& getError() { return fErrStr; } const std::string& getError() { return fErrStr; }
private: private:
MYSQL* fCon; MYSQL* fCon;
MYSQL_RES* fRes; MYSQL_RES* fRes;
MYSQL_FIELD* fFields;
std::string fErrStr; std::string fErrStr;
unsigned long *fieldLengths; unsigned long *fieldLengths;
}; };
@@ -157,7 +160,7 @@ protected:
virtual void makeMappings(); virtual void makeMappings();
virtual void addFilterStr(const std::vector<const execplan::Filter*>&, const std::string&); virtual void addFilterStr(const std::vector<const execplan::Filter*>&, const std::string&);
virtual std::string makeQuery(); virtual std::string makeQuery();
virtual void setField(int, const char*, unsigned long, rowgroup::Row&); virtual void setField(int, const char*, unsigned long, MYSQL_FIELD*, rowgroup::Row&);
inline void addRow(rowgroup::RGData &); inline void addRow(rowgroup::RGData &);
//inline void addRow(boost::shared_array<uint8_t>&); //inline void addRow(boost::shared_array<uint8_t>&);
virtual int64_t convertValueNum( virtual int64_t convertValueNum(