summaryrefslogtreecommitdiffstats
path: root/tests/test_optimizer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
commit243d9a15edd910136313a7a9fa7d7f24b494e169 (patch)
tree22d768ca708dc5caa8230705a9155ba1a343502b /tests/test_optimizer.py
parentAdding upstream version 11.3.0. (diff)
downloadsqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.tar.xz
sqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.zip
Adding upstream version 11.3.3.upstream/11.3.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_optimizer.py')
-rw-r--r--tests/test_optimizer.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py
index 8ddd95f..e10d05e 100644
--- a/tests/test_optimizer.py
+++ b/tests/test_optimizer.py
@@ -364,6 +364,11 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
expression = annotate_types(parse_one("ARRAY(1)::ARRAY<INT>"))
self.assertEqual(expression.type, parse_one("ARRAY<INT>", into=exp.DataType))
+ expression = annotate_types(parse_one("CAST(x AS INTERVAL)"))
+ self.assertEqual(expression.type.this, exp.DataType.Type.INTERVAL)
+ self.assertEqual(expression.this.type.this, exp.DataType.Type.UNKNOWN)
+ self.assertEqual(expression.args["to"].type.this, exp.DataType.Type.INTERVAL)
+
def test_cache_annotation(self):
expression = annotate_types(
parse_one("CACHE LAZY TABLE x OPTIONS('storageLevel' = 'value') AS SELECT 1")