ayushdg opened a new issue, #5626:
URL: https://github.com/apache/arrow-datafusion/issues/5626
**Describe the bug**
When creating a logical plan using `SqlToRel` with options that do not
`enable_ident_normalization`, identifiers still end up getting normalized in
some cases.
**To Reproduce**
```rust
let sql = "SELECT UPPERCASE from test";
let dialect = GenericDialect {};
let ast = Parser::parse_sql(&dialect, sql).unwrap();
let statement = &ast[0];
let schema_provider = MySchemaProvider::new();
let options = ParserOptions {
parse_float_as_decimal: false,
enable_ident_normalization: false,
};
let sql_to_rel = SqlToRel::new_with_options(&schema_provider, options);
let plan = sql_to_rel.sql_statement_to_plan(statement.clone()).unwrap();
println!("{plan:?}");
```
Where `MySchemaProvider` has the following
```rust
tables.insert(
"test".to_string(),
create_table_source(vec![Field::new("UPPERCASE", DataType::Int32,
false)]),
);
```
Leads to:
```
SchemaError(FieldNotFound { field: Column { relation: None, name:
"uppercase" }, valid_fields: [Column { relation: Some(Bare { table: "test" }),
name: "UPPERCASE" }] })'
```
Definition of everything else is taken from this
[example](https://github.com/apache/arrow-datafusion/blob/36fe9745407351277649ce07a12f036a2bb653a5/datafusion/sql/examples/sql.rs).
**Expected behavior**
When `enable_ident_normalization` is false, the identified `UPPERCASE`
shouldn't be normalized to `uppercase`.
**Additional context**
Looks like this particular case stems from
https://github.com/apache/arrow-datafusion/blob/36fe9745407351277649ce07a12f036a2bb653a5/datafusion/sql/src/expr/identifier.rs#L46-L48
but generally a few places use `utils::normalize_ident` instead of
`planner::normalize_ident`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]