Skip to content

Unable to query for iceberg table if there are same field names in top level and nested struct #15393

@bluzy

Description

@bluzy

We are using Trino 387.

I tried to use Iceberg connector, but some queries are failed with Multiple entries with same key error.

For verify the problem, I've created a table for test as below using spark sql:

-- HiveCatalog: dev

create table dev.test_db.iceberg_trino_test (
 id string,
 nested1 struct<id: string>,
 nested2 struct<id: string>
) using iceberg;

insert into dev.test_db.iceberg_trino_test (id, nested1, nested2)
 values ('0', named_struct('id', '1'), named_struct('id', '2'));

Then tried to query on Trino, and got error. (The query works well on Hive)

select * from test_db.iceberg_trino_test
where nested1.id='1' and nested2.id='2';

Query failed (#20221214_094933_00231_ngidj): Error opening Iceberg split hdfs://warehouse/test_db.db/iceberg_trino_test/data/00000-0-9c521b08-195f-4246-bbec-064bc007fe65-00001.parquet (offset=4, length=1029): Multiple entries with same key: [id] required binary id (STRING) = 1=[ SortedRangeSet[type=varchar, ranges=1, {[2]}] ] and [id] required binary id (STRING) = 1=[ SortedRangeSet[type=varchar, ranges=1, {[1]}] ] java.lang.IllegalArgumentException: Multiple entries with same key: [id] required binary id (STRING) = 1=[ SortedRangeSet[type=varchar, ranges=1, {[2]}] ] and [id] required binary id (STRING) = 1=[ SortedRangeSet[type=varchar, ranges=1, {[1]}] ]

I think that iceberg connector aware just last field name for get field-id, not including whole nested structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions