summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:45 +0000
commita34653eb21369376f0e054dd989311afcb167f5b (patch)
tree5a0280adce195af0be654f79fd99395fd2932c19 /tests/test_transpile.py
parentReleasing debian version 18.7.0-1. (diff)
downloadsqlglot-a34653eb21369376f0e054dd989311afcb167f5b.tar.xz
sqlglot-a34653eb21369376f0e054dd989311afcb167f5b.zip
Merging upstream version 18.11.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index a5b1977..d588f07 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -156,9 +156,7 @@ SELECT * FROM foo
-- comment 2
-- comment 3
SELECT * FROM foo""",
- """/* comment 1 */
-/* comment 2 */
-/* comment 3 */
+ """/* comment 1 */ /* comment 2 */ /* comment 3 */
SELECT
*
FROM foo""",
@@ -182,8 +180,7 @@ line3*/ /*another comment*/ where 1=1 -- comment at the end""",
*
FROM tbl /* line1
line2
-line3 */
-/* another comment */
+line3 */ /* another comment */
WHERE
1 = 1 /* comment at the end */""",
pretty=True,
@@ -310,9 +307,7 @@ FROM v""",
-- comment3
DROP TABLE IF EXISTS db.tba
""",
- """/* comment1 */
-/* comment2 */
-/* comment3 */
+ """/* comment1 */ /* comment2 */ /* comment3 */
DROP TABLE IF EXISTS db.tba""",
pretty=True,
)
@@ -337,9 +332,7 @@ SELECT
c
FROM tb_01
WHERE
- a /* comment5 */ = 1 AND b = 2 /* comment6 */
- /* and c = 1 */
- /* comment7 */""",
+ a /* comment5 */ = 1 AND b = 2 /* comment6 */ /* and c = 1 */ /* comment7 */""",
pretty=True,
)
self.validate(
@@ -375,11 +368,17 @@ INNER JOIN b""",
"""SELECT
*
FROM a
-/* comment 1 */
-/* comment 2 */
+/* comment 1 */ /* comment 2 */
LEFT OUTER JOIN b""",
pretty=True,
)
+ self.validate(
+ "SELECT\n a /* sqlglot.meta case_sensitive */ -- noqa\nFROM tbl",
+ """SELECT
+ a /* sqlglot.meta case_sensitive */ /* noqa */
+FROM tbl""",
+ pretty=True,
+ )
def test_types(self):
self.validate("INT 1", "CAST(1 AS INT)")
@@ -468,12 +467,12 @@ LEFT OUTER JOIN b""",
"ALTER TABLE integers ADD COLUMN k INT",
)
self.validate(
- "ALTER TABLE integers ALTER i SET DATA TYPE VARCHAR",
- "ALTER TABLE integers ALTER COLUMN i TYPE VARCHAR",
+ "ALTER TABLE integers ALTER i TYPE VARCHAR",
+ "ALTER TABLE integers ALTER COLUMN i SET DATA TYPE VARCHAR",
)
self.validate(
"ALTER TABLE integers ALTER i TYPE VARCHAR COLLATE foo USING bar",
- "ALTER TABLE integers ALTER COLUMN i TYPE VARCHAR COLLATE foo USING bar",
+ "ALTER TABLE integers ALTER COLUMN i SET DATA TYPE VARCHAR COLLATE foo USING bar",
)
def test_time(self):
@@ -604,7 +603,7 @@ LEFT OUTER JOIN b""",
self.validate(
"CREATE TEMPORARY TABLE test AS SELECT 1",
"CREATE TEMPORARY VIEW test AS SELECT 1",
- write="spark",
+ write="spark2",
)
@mock.patch("sqlglot.helper.logger")