apache / apache/datafusion-sqlparser-rs
Escaping of non-latin column names
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 772
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 17
Description
Hello!
I'm using `DataFusion` to query my csv file. The problem is: column names consists of Cyrillic letters and within sql query I need a way to escape column names. I've tried: single quotes, double quotes, backticks, square brackets.
In all cases I get the following error:
```
2021-02-22T20:45:46.090317300+03:00 DEBUG sqlparser::parser - parsing expr
2021-02-22T20:45:46.092602200+03:00 ERROR convert - error: SQL error: ParserError("Expected an expression:, found: `")
```
Code sample:
```rust
let mut ctx = ExecutionContext::new();
let csv_file = CsvFile::try_new(args.input.as_path().to_str().unwrap(), CsvReadOptions::new())?;
ctx.register_table("transactions", Arc::new(csv_file));
let df = ctx.sql("SELECT `ДАТА` FROM transactions")?;
let results = df.collect().await?;
log::info!("result: {:?}", results);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The report exercises the SQL parser through `ctx.sql(...)` and shows the failing `sqlparser::parser` path; begin by tracing how quoted identifiers are parsed. Reproduce the query with the Cyrillic column name and verify that a supported escaping form parses successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100