summaryrefslogtreecommitdiffstats
path: root/tests/dialects
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-22 07:22:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-22 07:22:56 +0000
commit85bf7f61d00f60343363b7c6dc98f2d0b5a8e621 (patch)
tree76c8712faaa2753e3997de25eb3a69c3ec450979 /tests/dialects
parentAdding upstream version 10.2.6. (diff)
downloadsqlglot-85bf7f61d00f60343363b7c6dc98f2d0b5a8e621.tar.xz
sqlglot-85bf7f61d00f60343363b7c6dc98f2d0b5a8e621.zip
Adding upstream version 10.2.9.upstream/10.2.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects')
-rw-r--r--tests/dialects/test_snowflake.py2
-rw-r--r--tests/dialects/test_tsql.py24
2 files changed, 23 insertions, 3 deletions
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index bca5aaa..e3d0cff 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -496,7 +496,7 @@ FROM cs.telescope.dag_report, TABLE(FLATTEN(input => SPLIT(operators, ','))) AS
f.value AS "Contact",
f1.value['type'] AS "Type",
f1.value['content'] AS "Details"
-FROM persons AS p, LATERAL FLATTEN(input => p.c, path => 'contact') f, LATERAL FLATTEN(input => f.value['business']) f1""",
+FROM persons AS p, LATERAL FLATTEN(input => p.c, path => 'contact') AS f, LATERAL FLATTEN(input => f.value['business']) AS f1""",
},
pretty=True,
)
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index afdd48a..e4c6e60 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -371,13 +371,19 @@ class TestTSQL(Validator):
self.validate_all(
"SELECT t.x, y.z FROM x CROSS APPLY tvfTest(t.x)y(z)",
write={
- "spark": "SELECT t.x, y.z FROM x JOIN LATERAL TVFTEST(t.x) y AS z",
+ "spark": "SELECT t.x, y.z FROM x JOIN LATERAL TVFTEST(t.x) AS y(z)",
},
)
self.validate_all(
"SELECT t.x, y.z FROM x OUTER APPLY tvfTest(t.x)y(z)",
write={
- "spark": "SELECT t.x, y.z FROM x LEFT JOIN LATERAL TVFTEST(t.x) y AS z",
+ "spark": "SELECT t.x, y.z FROM x LEFT JOIN LATERAL TVFTEST(t.x) AS y(z)",
+ },
+ )
+ self.validate_all(
+ "SELECT t.x, y.z FROM x OUTER APPLY a.b.tvfTest(t.x)y(z)",
+ write={
+ "spark": "SELECT t.x, y.z FROM x LEFT JOIN LATERAL a.b.TVFTEST(t.x) AS y(z)",
},
)
@@ -421,3 +427,17 @@ class TestTSQL(Validator):
self.validate_all(
"SELECT FORMAT(num_col, 'c')", write={"spark": "SELECT FORMAT_NUMBER(num_col, 'c')"}
)
+
+ def test_string(self):
+ self.validate_all(
+ "SELECT N'test'",
+ write={"spark": "SELECT 'test'"},
+ )
+ self.validate_all(
+ "SELECT n'test'",
+ write={"spark": "SELECT 'test'"},
+ )
+ self.validate_all(
+ "SELECT '''test'''",
+ write={"spark": r"SELECT '\'test\''"},
+ )