summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_dialect.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_dialect.py')
-rw-r--r--tests/dialects/test_dialect.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py
index 4b1e2a7..b50fec8 100644
--- a/tests/dialects/test_dialect.py
+++ b/tests/dialects/test_dialect.py
@@ -729,7 +729,7 @@ class TestDialect(Validator):
write={
"duckdb": "TO_TIMESTAMP(x)",
"hive": "FROM_UNIXTIME(x)",
- "oracle": "TO_DATE('1970-01-01','YYYY-MM-DD') + (x / 86400)",
+ "oracle": "TO_DATE('1970-01-01', 'YYYY-MM-DD') + (x / 86400)",
"postgres": "TO_TIMESTAMP(x)",
"presto": "FROM_UNIXTIME(x)",
"starrocks": "FROM_UNIXTIME(x)",
@@ -2272,3 +2272,32 @@ SELECT
"tsql": "RAND()",
},
)
+
+ def test_array_any(self):
+ self.validate_all(
+ "ARRAY_ANY(arr, x -> pred)",
+ write={
+ "": "ARRAY_ANY(arr, x -> pred)",
+ "bigquery": "(ARRAY_LENGTH(arr) = 0 OR ARRAY_LENGTH(ARRAY(SELECT x FROM UNNEST(arr) AS x WHERE pred)) <> 0)",
+ "clickhouse": "(LENGTH(arr) = 0 OR LENGTH(arrayFilter(x -> pred, arr)) <> 0)",
+ "databricks": "(SIZE(arr) = 0 OR SIZE(FILTER(arr, x -> pred)) <> 0)",
+ "doris": UnsupportedError,
+ "drill": UnsupportedError,
+ "duckdb": "(ARRAY_LENGTH(arr) = 0 OR ARRAY_LENGTH(LIST_FILTER(arr, x -> pred)) <> 0)",
+ "hive": UnsupportedError,
+ "mysql": UnsupportedError,
+ "oracle": UnsupportedError,
+ "postgres": "(ARRAY_LENGTH(arr, 1) = 0 OR ARRAY_LENGTH(ARRAY(SELECT x FROM UNNEST(arr) AS _t(x) WHERE pred), 1) <> 0)",
+ "presto": "ANY_MATCH(arr, x -> pred)",
+ "redshift": UnsupportedError,
+ "snowflake": UnsupportedError,
+ "spark": "(SIZE(arr) = 0 OR SIZE(FILTER(arr, x -> pred)) <> 0)",
+ "spark2": "(SIZE(arr) = 0 OR SIZE(FILTER(arr, x -> pred)) <> 0)",
+ "sqlite": UnsupportedError,
+ "starrocks": UnsupportedError,
+ "tableau": UnsupportedError,
+ "teradata": "(CARDINALITY(arr) = 0 OR CARDINALITY(FILTER(arr, x -> pred)) <> 0)",
+ "trino": "ANY_MATCH(arr, x -> pred)",
+ "tsql": UnsupportedError,
+ },
+ )