summaryrefslogtreecommitdiffstats
path: root/sqlglot/dataframe/sql/column.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dataframe/sql/column.py')
-rw-r--r--sqlglot/dataframe/sql/column.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sqlglot/dataframe/sql/column.py b/sqlglot/dataframe/sql/column.py
index f9e1c5b..22075e9 100644
--- a/sqlglot/dataframe/sql/column.py
+++ b/sqlglot/dataframe/sql/column.py
@@ -260,7 +260,10 @@ class Column:
"""
if isinstance(dataType, DataType):
dataType = dataType.simpleString()
- new_expression = exp.Cast(this=self.column_expression, to=dataType)
+ new_expression = exp.Cast(
+ this=self.column_expression,
+ to=sqlglot.parse_one(dataType, into=exp.DataType, read="spark"), # type: ignore
+ )
return Column(new_expression)
def startswith(self, value: t.Union[str, Column]) -> Column: