summaryrefslogtreecommitdiffstats
path: root/tests/test_optimizer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:15 +0000
commit5b1ac5070c43c40a2b5bbc991198b0dddf45dc75 (patch)
treeed329138d5e8e5c9d5164b5c853d6f40a116f4d6 /tests/test_optimizer.py
parentReleasing debian version 11.3.0-1. (diff)
downloadsqlglot-5b1ac5070c43c40a2b5bbc991198b0dddf45dc75.tar.xz
sqlglot-5b1ac5070c43c40a2b5bbc991198b0dddf45dc75.zip
Merging upstream version 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")