use crate::ast::Expr;
use crate::dialect::Dialect;
use crate::parser::{Parser, ParserError};
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SparkSqlDialect;
impl Dialect for SparkSqlDialect {
fn is_delimited_identifier_start(&self, ch: char) -> bool {
matches!(ch, '`')
}
fn supports_string_literal_column_alias(&self, _explicit: bool) -> bool {
false
}
fn supports_string_literal_table_alias(&self, _explicit: bool) -> bool {
false
}
fn supports_comparison_in_between_low_bound(&self) -> bool {
true
}
fn identifier_quote_style(&self, _identifier: &str) -> Option<char> {
Some('`')
}
fn is_identifier_start(&self, ch: char) -> bool {
matches!(ch, 'a'..='z' | 'A'..='Z' | '_')
}
fn is_identifier_part(&self, ch: char) -> bool {
matches!(ch, 'a'..='z' | 'A'..='Z' | '0'..='9' | '_')
}
fn supports_filter_during_aggregation(&self) -> bool {
true
}
fn supports_group_by_expr(&self) -> bool {
true
}
fn supports_group_by_with_modifier(&self) -> bool {
true
}
fn supports_lambda_functions(&self) -> bool {
true
}
fn supports_select_wildcard_except(&self) -> bool {
true
}
fn supports_struct_literal(&self) -> bool {
true
}
fn supports_nested_comments(&self) -> bool {
true
}
fn supports_create_table_using(&self) -> bool {
true
}
fn supports_long_type_as_bigint(&self) -> bool {
true
}
fn supports_values_as_table_factor(&self) -> bool {
true
}
fn require_interval_qualifier(&self) -> bool {
true
}
fn supports_bang_not_operator(&self) -> bool {
true
}
fn supports_select_item_multi_column_alias(&self) -> bool {
true
}
fn supports_cte_without_as(&self) -> bool {
true
}
fn supports_map_literal_with_angle_brackets(&self) -> bool {
true
}
fn supports_pipe_operator(&self) -> bool {
true
}
fn parse_infix(
&self,
parser: &mut Parser,
expr: &Expr,
precedence: u8,
) -> Option<Result<Expr, ParserError>> {
super::parse_div_infix(parser, expr, precedence)
}
}