Support more DateTimeField variants (#1191)

This commit is contained in:
Ifeanyi Ubah 2024-04-09 23:16:03 +02:00 committed by GitHub
parent 8dd213cff2
commit 127be97369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 129 additions and 46 deletions

View file

@ -1462,6 +1462,19 @@ fn test_bigquery_trim() {
);
}
#[test]
fn parse_extract_weekday() {
let sql = "SELECT EXTRACT(WEEK(MONDAY) FROM d)";
let select = bigquery_and_generic().verified_only_select(sql);
assert_eq!(
&Expr::Extract {
field: DateTimeField::Week(Some(Ident::new("MONDAY"))),
expr: Box::new(Expr::Identifier(Ident::new("d"))),
},
expr_from_projection(only(&select.projection)),
);
}
#[test]
fn test_select_as_struct() {
bigquery().verified_only_select("SELECT * FROM (SELECT AS VALUE STRUCT(123 AS a, false AS b))");