summaryrefslogtreecommitdiffstats
path: root/tests/dataframe
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
commit258c7df9cab21a4978c100568907ac1cb7fd6ee0 (patch)
treea98c4c9fc7433833be72543de5d99d15b9927442 /tests/dataframe
parentAdding upstream version 20.4.0. (diff)
downloadsqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.tar.xz
sqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.zip
Adding upstream version 20.9.0.upstream/20.9.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dataframe')
-rw-r--r--tests/dataframe/unit/test_functions.py12
-rw-r--r--tests/dataframe/unit/test_session.py2
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/dataframe/unit/test_functions.py b/tests/dataframe/unit/test_functions.py
index 54b327c..c845441 100644
--- a/tests/dataframe/unit/test_functions.py
+++ b/tests/dataframe/unit/test_functions.py
@@ -809,7 +809,7 @@ class TestFunctions(unittest.TestCase):
self.assertEqual("DATE_ADD(cola, colb)", col_col_for_add.sql())
current_date_add = SF.date_add(SF.current_date(), 5)
self.assertEqual("DATE_ADD(CURRENT_DATE, 5)", current_date_add.sql())
- self.assertEqual("DATEADD(day, 5, CURRENT_DATE)", current_date_add.sql(dialect="snowflake"))
+ self.assertEqual("DATEADD(DAY, 5, CURRENT_DATE)", current_date_add.sql(dialect="snowflake"))
def test_date_sub(self):
col_str = SF.date_sub("cola", 2)
@@ -859,15 +859,15 @@ class TestFunctions(unittest.TestCase):
def test_trunc(self):
col_str = SF.trunc("cola", "year")
- self.assertEqual("TRUNC(cola, 'year')", col_str.sql())
+ self.assertEqual("TRUNC(cola, 'YEAR')", col_str.sql())
col = SF.trunc(SF.col("cola"), "year")
- self.assertEqual("TRUNC(cola, 'year')", col.sql())
+ self.assertEqual("TRUNC(cola, 'YEAR')", col.sql())
def test_date_trunc(self):
col_str = SF.date_trunc("year", "cola")
- self.assertEqual("DATE_TRUNC('year', cola)", col_str.sql())
- col = SF.date_trunc("year", SF.col("cola"))
- self.assertEqual("DATE_TRUNC('year', cola)", col.sql())
+ self.assertEqual("DATE_TRUNC('YEAR', cola)", col_str.sql())
+ col = SF.date_trunc("YEAR", SF.col("cola"))
+ self.assertEqual("DATE_TRUNC('YEAR', cola)", col.sql())
def test_next_day(self):
col_str = SF.next_day("cola", "Mon")
diff --git a/tests/dataframe/unit/test_session.py b/tests/dataframe/unit/test_session.py
index 9758033..e2ebae4 100644
--- a/tests/dataframe/unit/test_session.py
+++ b/tests/dataframe/unit/test_session.py
@@ -61,7 +61,7 @@ class TestDataframeSession(DataFrameSQLValidator):
]
)
df = self.spark.createDataFrame([[{"sub_cola": 1, "sub_colb": "test"}]], schema)
- expected = "SELECT CAST(`a2`.`cola` AS STRUCT<`sub_cola`: INT, `sub_colb`: STRING>) AS `cola` FROM VALUES (STRUCT(1 AS `sub_cola`, 'test' AS `sub_colb`)) AS `a2`(`cola`)"
+ expected = "SELECT `a2`.`cola` AS `cola` FROM VALUES (STRUCT(1 AS `sub_cola`, 'test' AS `sub_colb`)) AS `a2`(`cola`)"
self.compare_sql(df, expected)