File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -3822,7 +3822,7 @@ impl<'a> Parser<'a> {
3822
3822
) ?,
3823
3823
} ,
3824
3824
// Case when Snowflake Semi-structured data like key:value
3825
- Keyword :: NoKeyword | Keyword :: LOCATION if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) => {
3825
+ Keyword :: NoKeyword | Keyword :: LOCATION | Keyword :: TYPE if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) => {
3826
3826
Ok ( Value :: UnQuotedString ( w. value ) )
3827
3827
}
3828
3828
_ => self . expected (
Original file line number Diff line number Diff line change @@ -169,6 +169,28 @@ fn parse_json_using_colon() {
169
169
select. projection[ 0 ]
170
170
) ;
171
171
172
+ let sql = "SELECT a:type FROM t" ;
173
+ let select = snowflake ( ) . verified_only_select ( sql) ;
174
+ assert_eq ! (
175
+ SelectItem :: UnnamedExpr ( Expr :: JsonAccess {
176
+ left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
177
+ operator: JsonOperator :: Colon ,
178
+ right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "type" . to_string( ) ) ) ) ,
179
+ } ) ,
180
+ select. projection[ 0 ]
181
+ ) ;
182
+
183
+ let sql = "SELECT a:location FROM t" ;
184
+ let select = snowflake ( ) . verified_only_select ( sql) ;
185
+ assert_eq ! (
186
+ SelectItem :: UnnamedExpr ( Expr :: JsonAccess {
187
+ left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
188
+ operator: JsonOperator :: Colon ,
189
+ right: Box :: new( Expr :: Value ( Value :: UnQuotedString ( "location" . to_string( ) ) ) ) ,
190
+ } ) ,
191
+ select. projection[ 0 ]
192
+ ) ;
193
+
172
194
snowflake ( ) . one_statement_parses_to ( "SELECT a:b::int FROM t" , "SELECT CAST(a:b AS INT) FROM t" ) ;
173
195
}
174
196
You can’t perform that action at this time.
0 commit comments