1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge branch 'develop-1.1' into develop-1.2-merge-up-20190619

This commit is contained in:
Andrew Hutchings
2019-06-19 18:34:43 +01:00
6 changed files with 40 additions and 18 deletions

View File

@ -548,6 +548,10 @@ public:
return fDerivedTbAlias; return fDerivedTbAlias;
} }
void derivedTbView(const std::string derivedTbView) { fDerivedTbView = derivedTbView; }
const std::string derivedTbView() const { return fDerivedTbView; }
void limitStart(const uint64_t limitStart) void limitStart(const uint64_t limitStart)
{ {
fLimitStart = limitStart; fLimitStart = limitStart;
@ -861,6 +865,7 @@ private:
// for subselect // for subselect
uint64_t fSubType; uint64_t fSubType;
std::string fDerivedTbAlias; std::string fDerivedTbAlias;
std::string fDerivedTbView;
// for limit // for limit
uint64_t fLimitStart; uint64_t fLimitStart;

View File

@ -862,6 +862,12 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARCHAR:
{ {
size_t length;
if (ci.utf8)
length = (ci.columnTypes[colpos].colWidth * 3);
else
length = ci.columnTypes[colpos].colWidth;
if (nullVal && (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT)) if (nullVal && (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT))
{ {
fprintf(ci.filePtr, "%c", ci.delimiter); fprintf(ci.filePtr, "%c", ci.delimiter);
@ -905,7 +911,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
dataLength = *(uint16_t*) buf; dataLength = *(uint16_t*) buf;
buf = buf + 2 ; buf = buf + 2 ;
} }
length = dataLength;
escape.assign((char*)buf, dataLength); escape.assign((char*)buf, dataLength);
boost::replace_all(escape, "\\", "\\\\"); boost::replace_all(escape, "\\", "\\\\");
fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter); fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter);
@ -922,9 +928,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
dataLength = *(uint16_t*) buf; dataLength = *(uint16_t*) buf;
buf = buf + 2 ; buf = buf + 2 ;
} }
length = dataLength;
if ( dataLength > ci.columnTypes[colpos].colWidth)
dataLength = ci.columnTypes[colpos].colWidth;
escape.assign((char*)buf, dataLength); escape.assign((char*)buf, dataLength);
boost::replace_all(escape, "\\", "\\\\"); boost::replace_all(escape, "\\", "\\\\");
@ -932,12 +936,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_
fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter); fprintf(ci.filePtr, "%c%.*s%c%c", ci.enclosed_by, (int)escape.length(), escape.c_str(), ci.enclosed_by, ci.delimiter);
} }
} }
buf += length;
//buf += ci.columnTypes[colpos].colWidth;
if (ci.utf8)
buf += (ci.columnTypes[colpos].colWidth * 3);
else
buf += ci.columnTypes[colpos].colWidth;
break; break;
} }

View File

@ -2183,7 +2183,14 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp)
sc->colPosition(j); sc->colPosition(j);
string tableAlias(csep->derivedTbAlias()); string tableAlias(csep->derivedTbAlias());
sc->tableAlias(lower(tableAlias)); sc->tableAlias(lower(tableAlias));
sc->viewName(lower(viewName)); if (!viewName.empty())
{
sc->viewName(viewName);
}
else
{
sc->viewName(csep->derivedTbView());
}
sc->resultType(cols[j]->resultType()); sc->resultType(cols[j]->resultType());
sc->hasAggregate(cols[j]->hasAggregate()); sc->hasAggregate(cols[j]->hasAggregate());

View File

@ -649,7 +649,11 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
// bug 3485, reserve enough space for the longest float value // bug 3485, reserve enough space for the longest float value
// -3.402823466E+38 to -1.175494351E-38, 0, and // -3.402823466E+38 to -1.175494351E-38, 0, and
// 1.175494351E-38 to 3.402823466E+38. // 1.175494351E-38 to 3.402823466E+38.
if (!f2->dec)
{
(*f)->field_length = 40; (*f)->field_length = 40;
f2->dec = row.getScale(s);
}
//float float_val = *(float*)(&value); //float float_val = *(float*)(&value);
//f2->store(float_val); //f2->store(float_val);
@ -679,7 +683,11 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
// bug 3483, reserve enough space for the longest double value // bug 3483, reserve enough space for the longest double value
// -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and // -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
// 2.2250738585072014E-308 to 1.7976931348623157E+308. // 2.2250738585072014E-308 to 1.7976931348623157E+308.
if (!f2->dec)
{
(*f)->field_length = 310; (*f)->field_length = 310;
f2->dec = row.getScale(s);
}
//double double_val = *(double*)(&value); //double double_val = *(double*)(&value);
//f2->store(double_val); //f2->store(double_val);

View File

@ -338,6 +338,7 @@ SCSEP FromSubQuery::transform()
gwi.subQuery = this; gwi.subQuery = this;
gwi.viewName = fGwip.viewName; gwi.viewName = fGwip.viewName;
csep->derivedTbAlias(fAlias); // always lower case csep->derivedTbAlias(fAlias); // always lower case
csep->derivedTbView(fGwip.viewName.alias);
if (getSelectPlan(gwi, *fFromSub, csep) != 0) if (getSelectPlan(gwi, *fFromSub, csep) != 0)
{ {

View File

@ -569,14 +569,16 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
} }
// Swap byte order before comparing character string // Swap byte order before comparing character string
int64_t binChar = static_cast<int64_t>( uint64ToStr( // Compare must be unsigned
*(reinterpret_cast<uint64_t*>(charTmpBuf)) ) ); uint64_t compChar = uint64ToStr( *(reinterpret_cast<uint64_t*>(charTmpBuf)) );
int64_t binChar = static_cast<int64_t>( compChar );
// Update min/max range // Update min/max range
if (binChar < bufStats.minBufferVal) uint64_t minVal = static_cast<uint64_t>( bufStats.minBufferVal );
uint64_t maxVal = static_cast<uint64_t>( bufStats.maxBufferVal );
if (compChar < minVal)
bufStats.minBufferVal = binChar; bufStats.minBufferVal = binChar;
if (compChar > maxVal)
if (binChar > bufStats.maxBufferVal)
bufStats.maxBufferVal = binChar; bufStats.maxBufferVal = binChar;
pVal = charTmpBuf; pVal = charTmpBuf;