File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5100,7 +5100,14 @@ impl<'a> Parser<'a> {
51005100 ) ?,
51015101 } ,
51025102 // Case when Snowflake Semi-structured data like key:value
5103- Keyword :: NoKeyword | Keyword :: LOCATION | Keyword :: TYPE | Keyword :: DATE if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) => {
5103+ Keyword :: NoKeyword
5104+ | Keyword :: LOCATION
5105+ | Keyword :: TYPE
5106+ | Keyword :: DATE
5107+ | Keyword :: START
5108+ | Keyword :: END
5109+ if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) =>
5110+ {
51045111 Ok ( Value :: UnQuotedString ( w. value ) )
51055112 }
51065113 _ => self . expected (
Original file line number Diff line number Diff line change @@ -229,6 +229,24 @@ fn parse_json_using_colon() {
229229 ) ;
230230
231231 snowflake ( ) . one_statement_parses_to ( "SELECT a:b::int FROM t" , "SELECT CAST(a:b AS INT) FROM t" ) ;
232+
233+ let sql = "SELECT a:start, a:end FROM t" ;
234+ let select = snowflake ( ) . verified_only_select ( sql) ;
235+ assert_eq ! (
236+ vec![
237+ SelectItem :: UnnamedExpr ( Expr :: JsonAccess {
238+ left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
239+ operator: JsonOperator :: Colon ,
240+ right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "start" . to_string( ) ) ) ) ,
241+ } ) ,
242+ SelectItem :: UnnamedExpr ( Expr :: JsonAccess {
243+ left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
244+ operator: JsonOperator :: Colon ,
245+ right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "end" . to_string( ) ) ) ) ,
246+ } )
247+ ] ,
248+ select. projection
249+ ) ;
232250}
233251
234252#[ test]
You can’t perform that action at this time.
0 commit comments