Fallback to parsing big integer from String instead of exception in Parquet format

This commit is contained in:
avogar 2023-06-12 11:34:40 +00:00
parent f5d88d2c05
commit 5cec4c3161
3 changed files with 13 additions and 6 deletions

View File

@ -202,13 +202,10 @@ static ColumnWithTypeAndName readColumnWithBigNumberFromBinaryData(std::shared_p
for (size_t i = 0; i != chunk_length; ++i) for (size_t i = 0; i != chunk_length; ++i)
{ {
/// If at least one value size is not equal to the size if big integer, fallback to reading String column and further cast to result type.
if (!chunk.IsNull(i) && chunk.value_length(i) != sizeof(ValueType)) if (!chunk.IsNull(i) && chunk.value_length(i) != sizeof(ValueType))
throw Exception( return readColumnWithStringData<arrow::BinaryArray>(arrow_column, column_name);
ErrorCodes::BAD_ARGUMENTS,
"Cannot insert data into {} column from binary value, expected data with size {}, got {}",
column_type->getName(),
sizeof(ValueType),
chunk.value_length(i));
total_size += chunk_length; total_size += chunk_length;
} }
} }

View File

@ -0,0 +1 @@
424242424242424242424242424242424242424242424242424242

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Tags: no-fasttest
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
$CLICKHOUSE_LOCAL -q "select toString(424242424242424242424242424242424242424242424242424242::UInt256) as x format Parquet" | $CLICKHOUSE_LOCAL --input-format=Parquet --structure='x UInt256' -q "select * from table"