summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_bigquery.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_bigquery.py')
-rw-r--r--tests/dialects/test_bigquery.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py
index eac3cac..3939ba0 100644
--- a/tests/dialects/test_bigquery.py
+++ b/tests/dialects/test_bigquery.py
@@ -108,6 +108,27 @@ class TestBigQuery(Validator):
self.validate_all("CAST(x AS TIMESTAMPTZ)", write={"bigquery": "CAST(x AS TIMESTAMP)"})
self.validate_all("CAST(x AS RECORD)", write={"bigquery": "CAST(x AS STRUCT)"})
self.validate_all(
+ "MD5(x)",
+ write={
+ "": "MD5_DIGEST(x)",
+ "bigquery": "MD5(x)",
+ "hive": "UNHEX(MD5(x))",
+ "spark": "UNHEX(MD5(x))",
+ },
+ )
+ self.validate_all(
+ "SELECT TO_HEX(MD5(some_string))",
+ read={
+ "duckdb": "SELECT MD5(some_string)",
+ "spark": "SELECT MD5(some_string)",
+ },
+ write={
+ "": "SELECT MD5(some_string)",
+ "bigquery": "SELECT TO_HEX(MD5(some_string))",
+ "duckdb": "SELECT MD5(some_string)",
+ },
+ )
+ self.validate_all(
"SELECT CAST('20201225' AS TIMESTAMP FORMAT 'YYYYMMDD' AT TIME ZONE 'America/New_York')",
write={"bigquery": "SELECT PARSE_TIMESTAMP('%Y%m%d', '20201225', 'America/New_York')"},
)
@@ -263,7 +284,7 @@ class TestBigQuery(Validator):
"duckdb": "CAST(a AS BIGINT)",
"presto": "CAST(a AS BIGINT)",
"hive": "CAST(a AS BIGINT)",
- "spark": "CAST(a AS LONG)",
+ "spark": "CAST(a AS BIGINT)",
},
)
self.validate_all(
@@ -413,7 +434,7 @@ class TestBigQuery(Validator):
"duckdb": "CREATE TABLE db.example_table (col_a STRUCT(struct_col_a BIGINT, struct_col_b STRUCT(nested_col_a TEXT, nested_col_b TEXT)))",
"presto": "CREATE TABLE db.example_table (col_a ROW(struct_col_a BIGINT, struct_col_b ROW(nested_col_a VARCHAR, nested_col_b VARCHAR)))",
"hive": "CREATE TABLE db.example_table (col_a STRUCT<struct_col_a BIGINT, struct_col_b STRUCT<nested_col_a STRING, nested_col_b STRING>>)",
- "spark": "CREATE TABLE db.example_table (col_a STRUCT<struct_col_a: LONG, struct_col_b: STRUCT<nested_col_a: STRING, nested_col_b: STRING>>)",
+ "spark": "CREATE TABLE db.example_table (col_a STRUCT<struct_col_a: BIGINT, struct_col_b: STRUCT<nested_col_a: STRING, nested_col_b: STRING>>)",
},
)
self.validate_all(