apache / apache/datafusion-sqlparser-rs
tokenizer is not case-sensitive for keyword determination
- Ngôn ngữ chính
- Rust
- Star
- 3.5k
- Fork
- 772
- Merge trung bình
- 4 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 17
Mô tả
Consider the following valid SQL statement:
`UPDATE machine_boards21
SET type = 'hybrid', model = 'LX21'
WHERE id = 'machine1';`
tokenizing produces the following output:
`Word(Word { value: "UPDATE", quote_style: None, keyword: UPDATE }), Whitespace(Space), Word(Word { value: "machine_boards21", quote_style: None, keyword: NoKeyword }), Whitespace(Newline), Word(Word { value: "SET", quote_style: None, keyword: SET }), Whitespace(Space), Word(Word { value: "type", quote_style: None, keyword: TYPE }), Whitespace(Space), Eq, Whitespace(Space), SingleQuotedString("hybrid"), Comma, Whitespace(Space), Word(Word { value: "model", quote_style: None, keyword: NoKeyword }), Whitespace(Space), Eq, Whitespace(Space), SingleQuotedString("LG"), Whitespace(Newline), Word(Word { value: "WHERE", quote_style: None, keyword: WHERE }), Whitespace(Space), Word(Word { value: "id", quote_style: None, keyword: NoKeyword }), Whitespace(Space), Eq, Whitespace(Space), SingleQuotedString("machine1"), SemiColon]`
notice how the 'type' token was interpreted: `Word(Word { value: "type", quote_style: None, keyword: TYPE })`
keyword TYPE... This causes an issue in `parse_assignments()` when `parse_identifiers_non_keywords()` is called
The error ultimately thrown by `calling parse_statement()` on this statement is as follows:
`ParserError("Expected =, found: type")`
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Tái hiện câu lệnh SQL từ issue và kiểm tra parse_assignments(), đặc biệt là lệnh gọi đến parse_identifiers_non_keywords(). Theo dõi cách tokenizer gán từ khóa TYPE cho token type không được đặt trong dấu nháy; hoàn thành khi câu lệnh được phân tích thành công mà không coi định danh đó là từ khóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust, sql
- Lĩnh vực
- compilers, databases
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100