Closed haitaoguan closed 1 year ago
In temp_table_low.cpp, the value max_length set incorrect.
In some expression column, there are more than one VarMap in var_map, the value max_length will minus (actual_size - precision)
more than one times, then get a negative number.
void TempTable::VerifyAttrsSizes() // verifies attr[i].field_size basing on the current multiindex contents
{
for (uint i = 0; i < attrs.size(); i++) {
......
int max_length = attrs[i]->term.vc->MaxStringSize();
if (dynamic_cast<vcolumn::ExpressionColumn *>(vc)) {
auto &var_map = dynamic_cast<vcolumn::ExpressionColumn *>(vc)->GetVarMap();
for (auto &it : var_map) {
PhysicalColumn *column = it.GetTabPtr()->GetColumn(it.col_ndx);
ColumnType ct = column->Type();
uint precision = ct.GetPrecision();
if (precision >= STRING_LENGTH_THRESHOLD) {
uint actual_size = column->MaxStringSize() * ct.GetCollation().collation->mbmaxlen;
if (actual_size < precision)
max_length += (actual_size - precision);
}
}
}
attrs[i]->OverrideStringSize(max_length);
}
}
}
Have you read the Contributing Guidelines on issues?
Please confirm if bug report does NOT exists already ?
Describe the problem
Expected behavior
No response
How To Reproduce
No response
Environment
./mysqld Ver 5.7.36-StoneDB-v1.0.4 for Linux on x86_64 (build-) build information as follow: Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev Branch name: stonedb-5.7-dev Last commit ID: 2bb2d48 Last commit time: Date: Thu Jul 13 10:04:56 2023 +0800 Build time: Date: Thu Jul 13 02:11:43 UTC 2023
Are you interested in submitting a PR to solve the problem?