diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:50:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:50:21 +0000 |
commit | da8fc943704a221b86f0f6938f4131f0dd679f82 (patch) | |
tree | bef7144499ea444319403ba8dbf68480ae3a4e39 /tests/test_transforms.py | |
parent | Adding upstream version 23.10.0. (diff) | |
download | sqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.tar.xz sqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.zip |
Adding upstream version 23.12.1.upstream/23.12.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transforms.py')
-rw-r--r-- | tests/test_transforms.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 8f14ae4..73d6705 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -111,6 +111,26 @@ class TestTransforms(unittest.TestCase): "SELECT x FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY p)", "SELECT x FROM (SELECT x, ROW_NUMBER() OVER (PARTITION BY p) AS _w, p FROM y) AS _t WHERE _w", ) + self.validate( + eliminate_qualify, + "SELECT x AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY z)", + "SELECT z FROM (SELECT x AS z, ROW_NUMBER() OVER (PARTITION BY x) AS _w, x FROM y) AS _t WHERE _w", + ) + self.validate( + eliminate_qualify, + "SELECT SOME_UDF(x) AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY z)", + "SELECT z FROM (SELECT SOME_UDF(x) AS z, ROW_NUMBER() OVER (PARTITION BY x ORDER BY SOME_UDF(x)) AS _w, x FROM y) AS _t WHERE _w", + ) + self.validate( + eliminate_qualify, + "SELECT x, t, x || t AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY z DESC)", + "SELECT x, t, z FROM (SELECT x, t, x || t AS z, ROW_NUMBER() OVER (PARTITION BY x ORDER BY x || t DESC) AS _w FROM y) AS _t WHERE _w", + ) + self.validate( + eliminate_qualify, + "SELECT y.x AS x, y.t AS z FROM y QUALIFY ROW_NUMBER() OVER (PARTITION BY x ORDER BY x DESC, z)", + "SELECT x, z FROM (SELECT y.x AS x, y.t AS z, ROW_NUMBER() OVER (PARTITION BY y.x ORDER BY y.x DESC, y.t) AS _w, y.t FROM y) AS _t WHERE _w", + ) def test_remove_precision_parameterized_types(self): self.validate( |