MCPcopy Index your code
hub / github.com/apache/datafusion / Dialect

Interface Dialect

datafusion/sql/src/unparser/dialect.rs:50–294  ·  view source on GitHub ↗

`Dialect` to use for Unparsing The default dialect tries to avoid quoting identifiers unless necessary (e.g. `a` instead of `"a"`) but this behavior can be overridden as needed Note**: This trait will eventually be replaced by the Dialect in the SQLparser package See See also the discussion in <https://github.com/apache/datafusion/pull/10

Source from the content-addressed store, hash-verified

48/// See <https://github.com/sqlparser-rs/sqlparser-rs/pull/1170>
49/// See also the discussion in <https://github.com/apache/datafusion/pull/10625>
50pub trait Dialect: Send + Sync {
51 /// Return the character used to quote identifiers.
52 fn identifier_quote_style(&self, _identifier: &str) -> Option<char>;
53
54 /// Whether array literals should be rendered with the `ARRAY[...]` keyword.
55 fn use_array_keyword_for_array_literals(&self) -> bool {
56 false
57 }
58
59 /// Does the dialect support specifying `NULLS FIRST/LAST` in `ORDER BY` clauses?
60 fn supports_nulls_first_in_sort(&self) -> bool {
61 true
62 }
63
64 /// Does the dialect use TIMESTAMP to represent Date64 rather than DATETIME?
65 /// E.g. Trino, Athena and Dremio does not have DATETIME data type
66 fn use_timestamp_for_date64(&self) -> bool {
67 false
68 }
69
70 fn interval_style(&self) -> IntervalStyle {
71 IntervalStyle::PostgresVerbose
72 }
73
74 /// Does the dialect use DOUBLE PRECISION to represent Float64 rather than DOUBLE?
75 /// E.g. Postgres uses DOUBLE PRECISION instead of DOUBLE
76 fn float64_ast_dtype(&self) -> ast::DataType {
77 ast::DataType::Double(ast::ExactNumberInfo::None)
78 }
79
80 /// The SQL type to use for Arrow Utf8 unparsing
81 /// Most dialects use VARCHAR, but some, like MySQL, require CHAR
82 fn utf8_cast_dtype(&self) -> ast::DataType {
83 ast::DataType::Varchar(None)
84 }
85
86 /// The SQL type to use for Arrow LargeUtf8 unparsing
87 /// Most dialects use TEXT, but some, like MySQL, require CHAR
88 fn large_utf8_cast_dtype(&self) -> ast::DataType {
89 ast::DataType::Text
90 }
91
92 /// The date field extract style to use: `DateFieldExtractStyle`
93 fn date_field_extract_style(&self) -> DateFieldExtractStyle {
94 DateFieldExtractStyle::DatePart
95 }
96
97 /// The character length extraction style to use: `CharacterLengthStyle`
98 fn character_length_style(&self) -> CharacterLengthStyle {
99 CharacterLengthStyle::CharacterLength
100 }
101
102 /// The SQL type to use for Arrow Int64 unparsing
103 /// Most dialects use BigInt, but some, like MySQL, require SIGNED
104 fn int64_cast_dtype(&self) -> ast::DataType {
105 ast::DataType::BigInt(None)
106 }
107

Callers 2

expr_to_sql_innerMethod · 0.80
handle_timestampMethod · 0.80

Implementers 2

dialect.rsdatafusion/sql/src/unparser/dialect.rs
test_mssql_dialect_national_literaldatafusion/sql/src/unparser/expr.rs

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…