ISSUES-4006 support decimal 256 for mysql block input stream

This commit is contained in:
zhang2014 2020-09-10 11:37:00 +08:00
parent 6ed3f7fb86
commit fea763bb75
3 changed files with 6 additions and 2 deletions

View File

@ -74,6 +74,8 @@ void ExternalResultDescription::init(const Block & sample_block_)
types.emplace_back(ValueType::vtDecimal64, is_nullable); types.emplace_back(ValueType::vtDecimal64, is_nullable);
else if (typeid_cast<const DataTypeDecimal<Decimal128> *>(type)) else if (typeid_cast<const DataTypeDecimal<Decimal128> *>(type))
types.emplace_back(ValueType::vtDecimal128, is_nullable); types.emplace_back(ValueType::vtDecimal128, is_nullable);
else if (typeid_cast<const DataTypeDecimal<Decimal256> *>(type))
types.emplace_back(ValueType::vtDecimal256, is_nullable);
else else
throw Exception{"Unsupported type " + type->getName(), ErrorCodes::UNKNOWN_TYPE}; throw Exception{"Unsupported type " + type->getName(), ErrorCodes::UNKNOWN_TYPE};
} }

View File

@ -29,7 +29,8 @@ struct ExternalResultDescription
vtDateTime64, vtDateTime64,
vtDecimal32, vtDecimal32,
vtDecimal64, vtDecimal64,
vtDecimal128 vtDecimal128,
vtDecimal256
}; };
Block sample_block; Block sample_block;

View File

@ -90,7 +90,8 @@ namespace
case ValueType::vtDateTime64:[[fallthrough]]; case ValueType::vtDateTime64:[[fallthrough]];
case ValueType::vtDecimal32: [[fallthrough]]; case ValueType::vtDecimal32: [[fallthrough]];
case ValueType::vtDecimal64: [[fallthrough]]; case ValueType::vtDecimal64: [[fallthrough]];
case ValueType::vtDecimal128: case ValueType::vtDecimal128:[[fallthrough]];
case ValueType::vtDecimal256:
{ {
ReadBuffer buffer(const_cast<char *>(value.data()), value.size(), 0); ReadBuffer buffer(const_cast<char *>(value.data()), value.size(), 0);
data_type.deserializeAsWholeText(column, buffer, FormatSettings{}); data_type.deserializeAsWholeText(column, buffer, FormatSettings{});