summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_spark.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:49 +0000
commit87bb420e43bf31021b090be98143a32042255a46 (patch)
treef68baf119ccffb6ebc64ba066af1491ddcb0f121 /tests/dialects/test_spark.py
parentAdding upstream version 21.0.2. (diff)
downloadsqlglot-87bb420e43bf31021b090be98143a32042255a46.tar.xz
sqlglot-87bb420e43bf31021b090be98143a32042255a46.zip
Adding upstream version 21.1.1.upstream/21.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_spark.py')
-rw-r--r--tests/dialects/test_spark.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/dialects/test_spark.py b/tests/dialects/test_spark.py
index 75bb91a..196735b 100644
--- a/tests/dialects/test_spark.py
+++ b/tests/dialects/test_spark.py
@@ -93,11 +93,12 @@ TBLPROPERTIES (
'x'='1'
)""",
"spark": """CREATE TABLE blah (
- col_a INT
+ col_a INT,
+ date STRING
)
COMMENT 'Test comment: blah'
PARTITIONED BY (
- date STRING
+ date
)
USING ICEBERG
TBLPROPERTIES (
@@ -125,13 +126,6 @@ TBLPROPERTIES (
"spark": "ALTER TABLE StudentInfo DROP COLUMNS (LastName, DOB)",
},
)
- self.validate_all(
- "CREATE TABLE x USING ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'",
- identify=True,
- write={
- "spark": "CREATE TABLE `x` USING ICEBERG PARTITIONED BY (MONTHS(`y`)) LOCATION 's3://z'",
- },
- )
def test_to_date(self):
self.validate_all(
@@ -257,6 +251,14 @@ TBLPROPERTIES (
self.validate_identity("TRIM(TRAILING 'SL' FROM 'SSparkSQLS')")
self.validate_identity("SPLIT(str, pattern, lim)")
self.validate_identity(
+ "SELECT CAST('2023-01-01' AS TIMESTAMP) + INTERVAL 23 HOUR + 59 MINUTE + 59 SECONDS",
+ "SELECT CAST('2023-01-01' AS TIMESTAMP) + INTERVAL '23' HOUR + INTERVAL '59' MINUTE + INTERVAL '59' SECONDS",
+ )
+ self.validate_identity(
+ "SELECT CAST('2023-01-01' AS TIMESTAMP) + INTERVAL '23' HOUR + '59' MINUTE + '59' SECONDS",
+ "SELECT CAST('2023-01-01' AS TIMESTAMP) + INTERVAL '23' HOUR + INTERVAL '59' MINUTE + INTERVAL '59' SECONDS",
+ )
+ self.validate_identity(
"SELECT INTERVAL '5' HOURS '30' MINUTES '5' SECONDS '6' MILLISECONDS '7' MICROSECONDS",
"SELECT INTERVAL '5' HOURS + INTERVAL '30' MINUTES + INTERVAL '5' SECONDS + INTERVAL '6' MILLISECONDS + INTERVAL '7' MICROSECONDS",
)
@@ -616,12 +618,6 @@ TBLPROPERTIES (
},
)
- def test_iif(self):
- self.validate_all(
- "SELECT IIF(cond, 'True', 'False')",
- write={"spark": "SELECT IF(cond, 'True', 'False')"},
- )
-
def test_bool_or(self):
self.validate_all(
"SELECT a, LOGICAL_OR(b) FROM table GROUP BY a",