Support bigquery CAST AS x [STRING|DATE] FORMAT syntax (#978)

This commit is contained in:
Lukasz Stefaniak 2023-10-20 20:33:12 +02:00 committed by GitHub
parent 83cb734b3c
commit c68e9775a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 6 deletions

View file

@ -1934,6 +1934,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::BigInt(None),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -1944,6 +1945,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::TinyInt(None),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -1970,6 +1972,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Nvarchar(Some(50)),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -1980,6 +1983,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Clob(None),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -1990,6 +1994,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Clob(Some(50)),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -2000,6 +2005,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Binary(Some(50)),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -2010,6 +2016,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Varbinary(Some(50)),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -2020,6 +2027,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Blob(None),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -2030,6 +2038,7 @@ fn parse_cast() {
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Blob(Some(50)),
format: None,
},
expr_from_projection(only(&select.projection))
);
@ -2043,6 +2052,7 @@ fn parse_try_cast() {
&Expr::TryCast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::BigInt(None),
format: None,
},
expr_from_projection(only(&select.projection))
);