File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5911,12 +5911,15 @@ impl<'a> Parser<'a> {
59115911 ) ?,
59125912 } ,
59135913 // Case when Snowflake Semi-structured data like key:value
5914+ // FIXME: Find a better way to deal with this than exhaustively
5915+ // listing every keyword allowed here.
59145916 Keyword :: NoKeyword
59155917 | Keyword :: LOCATION
59165918 | Keyword :: TYPE
59175919 | Keyword :: DATE
59185920 | Keyword :: START
59195921 | Keyword :: END
5922+ | Keyword :: DATA
59205923 if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) =>
59215924 {
59225925 Ok ( Value :: UnQuotedString ( w. value ) )
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ fn parse_json_using_colon() {
230230
231231 snowflake ( ) . one_statement_parses_to ( "SELECT a:b::int FROM t" , "SELECT CAST(a:b AS INT) FROM t" ) ;
232232
233- let sql = "SELECT a:start, a:end FROM t" ;
233+ let sql = "SELECT a:start, a:end, a:data FROM t" ;
234234 let select = snowflake ( ) . verified_only_select ( sql) ;
235235 assert_eq ! (
236236 vec![
@@ -243,6 +243,11 @@ fn parse_json_using_colon() {
243243 left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
244244 operator: JsonOperator :: Colon ,
245245 right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "end" . to_string( ) ) ) ) ,
246+ } ) ,
247+ SelectItem :: UnnamedExpr ( Expr :: JsonAccess {
248+ left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
249+ operator: JsonOperator :: Colon ,
250+ right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "data" . to_string( ) ) ) ) ,
246251 } )
247252 ] ,
248253 select. projection
You can’t perform that action at this time.
0 commit comments