File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5911,12 +5911,15 @@ impl<'a> Parser<'a> {
5911
5911
) ?,
5912
5912
} ,
5913
5913
// 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.
5914
5916
Keyword :: NoKeyword
5915
5917
| Keyword :: LOCATION
5916
5918
| Keyword :: TYPE
5917
5919
| Keyword :: DATE
5918
5920
| Keyword :: START
5919
5921
| Keyword :: END
5922
+ | Keyword :: DATA
5920
5923
if dialect_of ! ( self is SnowflakeDialect | GenericDialect ) =>
5921
5924
{
5922
5925
Ok ( Value :: UnQuotedString ( w. value ) )
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ fn parse_json_using_colon() {
230
230
231
231
snowflake ( ) . one_statement_parses_to ( "SELECT a:b::int FROM t" , "SELECT CAST(a:b AS INT) FROM t" ) ;
232
232
233
- let sql = "SELECT a:start, a:end FROM t" ;
233
+ let sql = "SELECT a:start, a:end, a:data FROM t" ;
234
234
let select = snowflake ( ) . verified_only_select ( sql) ;
235
235
assert_eq ! (
236
236
vec![
@@ -243,6 +243,11 @@ fn parse_json_using_colon() {
243
243
left: Box :: new( Expr :: Identifier ( Ident :: new( "a" ) ) ) ,
244
244
operator: JsonOperator :: Colon ,
245
245
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( ) ) ) ) ,
246
251
} )
247
252
] ,
248
253
select. projection
You can’t perform that action at this time.
0 commit comments