rustfs_s3select_api/query/
parser.rs1use std::collections::VecDeque;
16
17use datafusion::sql::sqlparser::dialect::Dialect;
18
19use super::ast::ExtStatement;
20use crate::QueryResult;
21
22#[derive(Debug, Default)]
23pub struct RustFsDialect;
24
25impl Dialect for RustFsDialect {
26 fn is_identifier_start(&self, ch: char) -> bool {
27 ch.is_alphabetic() || ch == '_' || ch == '#' || ch == '@'
28 }
29
30 fn is_identifier_part(&self, ch: char) -> bool {
31 ch.is_alphabetic() || ch.is_ascii_digit() || ch == '@' || ch == '$' || ch == '#' || ch == '_'
32 }
33
34 fn supports_group_by_expr(&self) -> bool {
35 true
36 }
37
38 fn supports_partiql(&self) -> bool {
39 true
40 }
41}
42
43pub trait Parser {
44 fn parse(&self, sql: &str) -> QueryResult<VecDeque<ExtStatement>>;
45}