Merge pull request #50873 from Avogar/parquet-big-integers

Fallback to parsing big integer from String instead of exception in Parquet format
This commit is contained in:
Kruglov Pavel 2023-06-20 16:10:46 +02:00 committed by GitHub
commit 0edfbb45ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
{
/// 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))
throw Exception(
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));
return readColumnWithStringData<arrow::BinaryArray>(arrow_column, column_name);
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"