File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1515// specific language governing permissions and limitations
1616// under the License.
1717
18- use crate :: dialect:: Dialect ;
18+ use crate :: dialect:: { Dialect , Precedence } ;
19+ use crate :: parser:: { Parser , ParserError } ;
20+ use crate :: tokenizer:: Token ;
1921
2022/// A [`Dialect`] for [Databricks SQL](https://www.databricks.com/)
2123///
@@ -38,6 +40,15 @@ impl Dialect for DatabricksDialect {
3840 matches ! ( ch, 'a' ..='z' | 'A' ..='Z' | '0' ..='9' | '_' )
3941 }
4042
43+ fn get_next_precedence ( & self , parser : & Parser ) -> Option < Result < u8 , ParserError > > {
44+ let token = parser. peek_token ( ) ;
45+ // : is used for JSON path access
46+ match token. token {
47+ Token :: Colon => Some ( Ok ( self . prec_value ( Precedence :: Period ) ) ) ,
48+ _ => None ,
49+ }
50+ }
51+
4152 fn supports_filter_during_aggregation ( & self ) -> bool {
4253 true
4354 }
Original file line number Diff line number Diff line change @@ -3567,7 +3567,8 @@ impl<'a> Parser<'a> {
35673567 expr: Box::new(expr),
35683568 })
35693569 } else if Token::LBracket == *tok && self.dialect.supports_partiql()
3570- || (dialect_of!(self is SnowflakeDialect | GenericDialect) && Token::Colon == *tok)
3570+ || (dialect_of!(self is SnowflakeDialect | GenericDialect | DatabricksDialect)
3571+ && Token::Colon == *tok)
35713572 {
35723573 self.prev_token();
35733574 self.parse_json_access(expr)
You can’t perform that action at this time.
0 commit comments