Backport #69787 to 24.8: Fix 'Bad get' in maxMap state serialization

This commit is contained in:
robot-clickhouse 2024-10-05 09:09:14 +00:00
parent 66bf2a0bf6
commit 024d898b0e
3 changed files with 5 additions and 2 deletions

View File

@ -298,12 +298,13 @@ public:
Field value = values[col_idx];
/// Compatibility with previous versions.
if (value.getType() == Field::Types::Decimal32)
WhichDataType value_type(values_types[col_idx]);
if (value_type.isDecimal32())
{
auto source = value.safeGet<DecimalField<Decimal32>>();
value = DecimalField<Decimal128>(source.getValue(), source.getScale());
}
else if (value.getType() == Field::Types::Decimal64)
else if (value_type.isDecimal64())
{
auto source = value.safeGet<DecimalField<Decimal64>>();
value = DecimalField<Decimal128>(source.getValue(), source.getScale());

View File

@ -0,0 +1 @@
{"x":"\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}

View File

@ -0,0 +1 @@
select maxMapState([0], [toDateTime64(0, 0)]) as x format JSONEachRow;