OscarTHZhang opened a new issue #1710:
URL: https://github.com/apache/arrow-datafusion/issues/1710
**Describe the bug**
If the column names in a CSV file are uppercase, then typing lowercase
column names in SQL queries will result in an Error: `Invalid identifier for
schema`.
**To Reproduce**
Here is a simple example program that runs a query on 2 tables.
```rust
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
let mut ctx = ExecutionContext::new();
ctx.register_csv("lineorder", "data/lineorder.csv",
CsvReadOptions::new()).await?;
ctx.register_csv("date", "data/date.csv", CsvReadOptions::new()).await?;
let df = ctx.sql("
select sum(lo_extendedprice * lo_discount) as revenue
from lineorder,
date
where lo_orderdate = d_datekey
and d_year = 1993
and (lo_discount between 1 and 3)
and lo_quantity < 25;
").await?;
df.show().await?;
Ok(())
}
```
This will result in an error:
```shell
Error: Plan("Invalid identifier '#lo_orderdate' for schema
lineorder.LO_ORDERKEY, lineorder.LO_LINENUMBER, lineorder.LO_CUSTKEY,
lineorder.LO_PARTKEY, lineorder.LO_SUPPKEY, lineorder.LO_ORDERDATE,
lineorder.LO_ORDERPRIORITY, lineorder.LO_SHIPPRIORITY, lineorder.LO_QUANTITY,
lineorder.LO_EXTENDEDPRICE, lineorder.LO_ORDTOTALPRICE, lineorder.LO_DISCOUNT,
lineorder.LO_REVENUE, lineorder.LO_SUPPLYCOST, lineorder.LO_TAX,
lineorder.LO_COMMITDATE, lineorder.LO_SHIPMODE, date.D_DATEKEY, date.D_DATE,
date.D_DAYOFWEEK, date.D_MONTH, date.D_YEAR, date.D_YEARMONTHNUM,
date.D_YEARMONTH, date.D_DAYNUMINWEEK, date.D_DAYNUMINMONTH,
date.D_DAYNUMINYEAR, date.D_MONTHNUMINYEAR, date.D_WEEKNUMINYEAR,
date.D_SELLINGSEASON, date.D_LASTDAYINWEEKFL, date.D_LASTDAYINMONTHFL,
date.D_HOLIDAYFL, date.D_WEEKDAYFL")
```
**Expected behavior**
The column names should not be case-sensitive. The query should execute
normally to produce the query result.
**Additional context**
Add any other context about the problem here.
--
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]