Skip to content

query result empty when a struct field name and a regular field name is same #8456

@anlihust

Description

@anlihust

Describe the bug

When a struct field name is the same as a regular field name, and the struct is declared before the regular field, it can cause issues when the field name in where clause

To Reproduce

construct a parquet file ,write 2 records as follow

    +---------------------+----+--------+
     | struct              | id | name   |
     +---------------------+----+--------+
     | {id: 1, name: aaa1} | 1  | test01 |
     | {id: 2, name: aaa2} | 2  | test02 |
     +---------------------+----+--------+

when execute sql select * from base_table where name='test01' ,will got empty result
here is the bug demo
https://github.com/anlihust/datafusion_demo/blob/main/src/main.rs

Expected behavior

when execute sql select * from base_table where name='test01' ,get the test01 record

    +---------------------+----+--------+
     | struct              | id | name   |
     +---------------------+----+--------+
     | {id: 1, name: aaa1} | 1  | test01 |
     +---------------------+----+--------+

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions