summaryrefslogtreecommitdiffstats
path: root/tests/dataframe/unit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:20:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:20:09 +0000
commit4554ab4c7d6b2bbbaa6f4d0b810bf477d1a505a6 (patch)
tree8f4f60a82ab9cd6dcd41397e4ecb2960c332b209 /tests/dataframe/unit
parentReleasing debian version 18.5.1-1. (diff)
downloadsqlglot-4554ab4c7d6b2bbbaa6f4d0b810bf477d1a505a6.tar.xz
sqlglot-4554ab4c7d6b2bbbaa6f4d0b810bf477d1a505a6.zip
Merging upstream version 18.7.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dataframe/unit')
-rw-r--r--tests/dataframe/unit/test_column.py6
-rw-r--r--tests/dataframe/unit/test_functions.py8
-rw-r--r--tests/dataframe/unit/test_session_case_sensitivity.py6
3 files changed, 13 insertions, 7 deletions
diff --git a/tests/dataframe/unit/test_column.py b/tests/dataframe/unit/test_column.py
index 665cc91..117789e 100644
--- a/tests/dataframe/unit/test_column.py
+++ b/tests/dataframe/unit/test_column.py
@@ -95,16 +95,16 @@ class TestDataframeColumn(unittest.TestCase):
self.assertEqual("cola IN (1, 2, 3)", F.col("cola").isin(1, 2, 3).sql())
def test_asc(self):
- self.assertEqual("cola", F.col("cola").asc().sql())
+ self.assertEqual("cola ASC", F.col("cola").asc().sql())
def test_desc(self):
self.assertEqual("cola DESC", F.col("cola").desc().sql())
def test_asc_nulls_first(self):
- self.assertEqual("cola", F.col("cola").asc_nulls_first().sql())
+ self.assertEqual("cola ASC", F.col("cola").asc_nulls_first().sql())
def test_asc_nulls_last(self):
- self.assertEqual("cola NULLS LAST", F.col("cola").asc_nulls_last().sql())
+ self.assertEqual("cola ASC NULLS LAST", F.col("cola").asc_nulls_last().sql())
def test_desc_nulls_first(self):
self.assertEqual("cola DESC NULLS FIRST", F.col("cola").desc_nulls_first().sql())
diff --git a/tests/dataframe/unit/test_functions.py b/tests/dataframe/unit/test_functions.py
index 2fb5650..586b8fc 100644
--- a/tests/dataframe/unit/test_functions.py
+++ b/tests/dataframe/unit/test_functions.py
@@ -335,18 +335,18 @@ class TestFunctions(unittest.TestCase):
def test_asc_nulls_first(self):
col_str = SF.asc_nulls_first("cola")
self.assertIsInstance(col_str.expression, exp.Ordered)
- self.assertEqual("cola", col_str.sql())
+ self.assertEqual("cola ASC", col_str.sql())
col = SF.asc_nulls_first(SF.col("cola"))
self.assertIsInstance(col.expression, exp.Ordered)
- self.assertEqual("cola", col.sql())
+ self.assertEqual("cola ASC", col.sql())
def test_asc_nulls_last(self):
col_str = SF.asc_nulls_last("cola")
self.assertIsInstance(col_str.expression, exp.Ordered)
- self.assertEqual("cola NULLS LAST", col_str.sql())
+ self.assertEqual("cola ASC NULLS LAST", col_str.sql())
col = SF.asc_nulls_last(SF.col("cola"))
self.assertIsInstance(col.expression, exp.Ordered)
- self.assertEqual("cola NULLS LAST", col.sql())
+ self.assertEqual("cola ASC NULLS LAST", col.sql())
def test_desc_nulls_first(self):
col_str = SF.desc_nulls_first("cola")
diff --git a/tests/dataframe/unit/test_session_case_sensitivity.py b/tests/dataframe/unit/test_session_case_sensitivity.py
index f9119b0..462edb6 100644
--- a/tests/dataframe/unit/test_session_case_sensitivity.py
+++ b/tests/dataframe/unit/test_session_case_sensitivity.py
@@ -79,3 +79,9 @@ class TestSessionCaseSensitivity(DataFrameTestBase):
df.sql()
else:
self.compare_sql(df, expected)
+
+ def test_alias(self):
+ col = F.col('"Name"')
+ self.assertEqual(col.sql(dialect=self.spark.dialect), '"Name"')
+ self.assertEqual(col.alias("nAME").sql(dialect=self.spark.dialect), '"Name" AS NAME')
+ self.assertEqual(col.alias('"nAME"').sql(dialect=self.spark.dialect), '"Name" AS "nAME"')