Use better types

This commit is contained in:
avogar 2022-11-11 13:17:48 +00:00
parent 88636b0f5b
commit 94c6dc42eb
2 changed files with 5 additions and 6 deletions

View File

@ -1223,13 +1223,12 @@ For output it uses the following correspondence between ClickHouse types and BSO
| [Bool](../sql-reference/data-types/boolean.md) | `\x08` boolean |
| [Int8/UInt8](../sql-reference/data-types/int-uint.md) | `\x10` int32 |
| [Int16UInt16](../sql-reference/data-types/int-uint.md) | `\x10` int32 |
| [Int32](../sql-reference/data-types/int-uint.md) | `\x10` int32 |
| [UInt32](../sql-reference/data-types/int-uint.md) | `\x12` int64 |
| [Int32/UInt32](../sql-reference/data-types/int-uint.md) | `\x10` int32 |
| [Int64](../sql-reference/data-types/int-uint.md) | `\x12` int64 |
| [UInt64](../sql-reference/data-types/int-uint.md) | `\x11` uint64 |
| [Float32/Float64](../sql-reference/data-types/float.md) | `\x01` double |
| [Date](../sql-reference/data-types/date.md)/[Date32](../sql-reference/data-types/date32.md) | `\x10` int32 |
| [DateTime](../sql-reference/data-types/datetime.md) | `\x12` int64 |
| [DateTime](../sql-reference/data-types/datetime.md) | `\x12` int32 |
| [DateTime64](../sql-reference/data-types/datetime64.md) | `\x09` datetime |
| [Decimal32](../sql-reference/data-types/decimal.md) | `\x10` int32 |
| [Decimal64](../sql-reference/data-types/decimal.md) | `\x12` int64 |

View File

@ -123,7 +123,9 @@ size_t BSONEachRowRowOutputFormat::countBSONFieldSize(const IColumn & column, co
case TypeIndex::UInt16: [[fallthrough]];
case TypeIndex::Date: [[fallthrough]];
case TypeIndex::Date32: [[fallthrough]];
case TypeIndex::DateTime: [[fallthrough]];
case TypeIndex::Decimal32: [[fallthrough]];
case TypeIndex::UInt32: [[fallthrough]];
case TypeIndex::Int32:
{
return size + sizeof(Int32);
@ -137,10 +139,8 @@ size_t BSONEachRowRowOutputFormat::countBSONFieldSize(const IColumn & column, co
}
case TypeIndex::Float32: [[fallthrough]];
case TypeIndex::Float64: [[fallthrough]];
case TypeIndex::UInt32: [[fallthrough]];
case TypeIndex::Int64: [[fallthrough]];
case TypeIndex::UInt64: [[fallthrough]];
case TypeIndex::DateTime: [[fallthrough]];
case TypeIndex::Decimal64: [[fallthrough]];
case TypeIndex::DateTime64:
{
@ -301,7 +301,7 @@ void BSONEachRowRowOutputFormat::serializeField(const IColumn & column, const Da
case TypeIndex::DateTime: [[fallthrough]];
case TypeIndex::UInt32:
{
writeBSONNumber<ColumnUInt32, Int64>(BSONType::INT64, column, row_num, name, out);
writeBSONNumber<ColumnUInt32, UInt32>(BSONType::INT32, column, row_num, name, out);
break;
}
case TypeIndex::Int64: