apache / apache/datafusion-sqlparser-rs

Escaping of non-latin column names

未關閉
#296 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
3.5k
分支
772
平均合併
4 天 9 小時
30 天內合併 PR
17

描述

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);
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

該報告透過 `ctx.sql(...)` 執行 SQL 解析器,並顯示失敗的 `sqlparser::parser` 路徑;首先追蹤帶引號識別碼的解析方式。使用西里爾字母欄位名稱重現該查詢,並驗證一種受支援的跳脫形式可以成功解析。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
rust, sql
領域
databases
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。