Skip to content

SELECT on column with uppercase column name fails with FieldNotFound error #2978

@mcassels

Description

@mcassels

Describe the bug

select UPPERCASE_NAME from t; fails with a FieldNotFound SchemaError like this:

SchemaError(FieldNotFound { qualifier: None, name: "uppercase_name", valid_fields: Some(["t.UPPERCASE_NAME"]) })

The name in the FieldNotFound error is the lower-case version of the selected column name.

To Reproduce

Using datafusion-cli on the attached test parquet file:

❯ CREATE EXTERNAL TABLE t STORED AS PARQUET LOCATION 'test.parquet';
0 rows in set. Query took 0.004 seconds.
❯ select * from t;
+----------------+--------------------+
| UPPERCASE_NAME | not_uppercase_name |
+----------------+--------------------+
| 3              | 3                  |
| 2              | 2                  |
| 1              | 1                  |
| 0              | 0                  |
+----------------+--------------------+
4 rows in set. Query took 0.008 seconds.
❯ select not_uppercase_name from t;
+--------------------+
| not_uppercase_name |
+--------------------+
| 3                  |
| 2                  |
| 1                  |
| 0                  |
+--------------------+
4 rows in set. Query took 0.007 seconds.
❯ select UPPERCASE_NAME from t;
SchemaError(FieldNotFound { qualifier: None, name: "uppercase_name", valid_fields: Some(["t.UPPERCASE_NAME", "t.not_uppercase_name"]) })
❯ 

Expected behavior

Expected that SELECTs on columns with uppercase names would behave the same as SELECTs on columns with lowercase names.

Additional context

Test parquet to reproduce the issue:
test.parquet.zip

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