diff options
Diffstat (limited to 'tests/dialects/test_hive.py')
-rw-r--r-- | tests/dialects/test_hive.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/dialects/test_hive.py b/tests/dialects/test_hive.py index 42d9943..a067764 100644 --- a/tests/dialects/test_hive.py +++ b/tests/dialects/test_hive.py @@ -214,11 +214,11 @@ class TestHive(Validator): self.validate_all( "'\\\\a'", read={ - "presto": "'\\a'", + "presto": "'\\\\a'", }, write={ - "duckdb": "'\\a'", - "presto": "'\\a'", + "duckdb": "'\\\\a'", + "presto": "'\\\\a'", "hive": "'\\\\a'", "spark": "'\\\\a'", }, @@ -345,13 +345,13 @@ class TestHive(Validator): "INSERT OVERWRITE TABLE zipcodes PARTITION(state = 0) VALUES (896, 'US', 'TAMPA', 33607)" ) self.validate_identity( - "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, b GROUPING SETS ((a, b), a)" + "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, b, GROUPING SETS ((a, b), a)" ) self.validate_identity( - "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, b GROUPING SETS ((t.a, b), a)" + "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, b, GROUPING SETS ((t.a, b), a)" ) self.validate_identity( - "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, FOO(b) GROUPING SETS ((a, FOO(b)), a)" + "SELECT a, b, SUM(c) FROM tabl AS t GROUP BY a, FOO(b), GROUPING SETS ((a, FOO(b)), a)" ) self.validate_identity( "SELECT key, value, GROUPING__ID, COUNT(*) FROM T1 GROUP BY key, value WITH CUBE" @@ -648,8 +648,20 @@ class TestHive(Validator): }, ) self.validate_all( - "SELECT a, SUM(c) FROM t GROUP BY a, DATE_FORMAT(b, 'yyyy') GROUPING SETS ((a, DATE_FORMAT(b, 'yyyy')), a)", + "SELECT a, SUM(c) FROM t GROUP BY a, DATE_FORMAT(b, 'yyyy'), GROUPING SETS ((a, DATE_FORMAT(b, 'yyyy')), a)", write={ - "hive": "SELECT a, SUM(c) FROM t GROUP BY a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy') GROUPING SETS ((a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy')), a)", + "hive": "SELECT a, SUM(c) FROM t GROUP BY a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy'), GROUPING SETS ((a, DATE_FORMAT(CAST(b AS TIMESTAMP), 'yyyy')), a)", }, ) + + def test_escapes(self) -> None: + self.validate_identity("'\n'") + self.validate_identity("'\\n'") + self.validate_identity("'\\\n'") + self.validate_identity("'\\\\n'") + self.validate_identity("''") + self.validate_identity("'\\\\'") + self.validate_identity("'\z'") + self.validate_identity("'\\z'") + self.validate_identity("'\\\z'") + self.validate_identity("'\\\\z'") |