Skip to content

Clarify in docs that Identifiers are made lower-case in SQL query #2374

@dbr

Description

@dbr

Describe the bug
With (I think) the most up-to-date version of the arrow2 branch, the idenfitiers in query seem to be made lower-case

For example if I modify the memtable example by renaming the bank_acount field to Bank_Account then the query will fail,

$ gd
diff --git a/datafusion-examples/examples/memtable.rs b/datafusion-examples/examples/memtable.rs
index 4c635205..16bd247d 100644
--- a/datafusion-examples/examples/memtable.rs
+++ b/datafusion-examples/examples/memtable.rs
@@ -37,7 +37,7 @@ async fn main() -> Result<()> {
     // Register the in-memory table containing the data
     ctx.register_table("users", Arc::new(mem_table))?;
 
-    let dataframe = ctx.sql("SELECT * FROM users;").await?;
+    let dataframe = ctx.sql("SELECT Bank_Account FROM users;").await?;
 
     timeout(Duration::from_secs(10), async move {
         let result = dataframe.collect().await.unwrap();
@@ -72,6 +72,6 @@ fn create_record_batch() -> Result<RecordBatch> {
 fn get_schema() -> SchemaRef {
     SchemaRef::new(Schema::new(vec![
         Field::new("id", DataType::UInt8, false),
-        Field::new("bank_account", DataType::UInt64, true),
+        Field::new("Bank_Account", DataType::UInt64, true),
     ]))
 }
$ cargo run --example memtable
    Finished dev [unoptimized + debuginfo] target(s) in 0.35s
     Running `./target/debug/examples/memtable`
Error: Plan("Invalid identifier '#bank_account' for schema fields:[users.id, users.Bank_Account], metadata:{}")

Meaning, if the source table has any non-lowercase characters, the queries cannot work

Additional context
I'm using the arrow2 branch at this revision:

744b262

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions