mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 11:32:03 +00:00
Merge pull request #48057 from Avogar/fix-avro-records
Use uniq names for Records in Avro to avoid reusing its schema
This commit is contained in:
commit
f3c594a160
@ -386,7 +386,9 @@ AvroSerializer::SchemaWithSerializeFn AvroSerializer::createSchemaWithSerializeF
|
||||
const auto & nested_names = tuple_type.getElementNames();
|
||||
std::vector<SerializeFn> nested_serializers;
|
||||
nested_serializers.reserve(nested_types.size());
|
||||
auto schema = avro::RecordSchema(column_name);
|
||||
/// We should use unique names for records. Otherwise avro will reuse schema of this record later
|
||||
/// for all records with the same name.
|
||||
auto schema = avro::RecordSchema(column_name + "_" + std::to_string(type_name_increment));
|
||||
for (size_t i = 0; i != nested_types.size(); ++i)
|
||||
{
|
||||
auto nested_mapping = createSchemaWithSerializeFn(nested_types[i], type_name_increment, nested_names[i]);
|
||||
|
@ -0,0 +1 @@
|
||||
((1,2)) ((3,4,5))
|
8
tests/queries/0_stateless/02592_avro_records_with_same_names.sh
Executable file
8
tests/queries/0_stateless/02592_avro_records_with_same_names.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: no-fasttest
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_LOCAL -q "select tuple(tuple(1, 2))::Tuple(x Tuple(a UInt32, b UInt32)) as c1, tuple(tuple(3, 4, 5))::Tuple(x Tuple(c UInt32, d UInt32, e UInt32)) as c2 format Avro" | $CLICKHOUSE_LOCAL --input-format Avro --structure 'c1 Tuple(x Tuple(a UInt32, b UInt32)), c2 Tuple(x Tuple(c UInt32, d UInt32, e UInt32))' -q "select * from table"
|
Loading…
Reference in New Issue
Block a user