summaryrefslogtreecommitdiffstats
path: root/sqlglot/dataframe/sql/session.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dataframe/sql/session.py')
-rw-r--r--sqlglot/dataframe/sql/session.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/sqlglot/dataframe/sql/session.py b/sqlglot/dataframe/sql/session.py
index 1ea86d1..8cb16ef 100644
--- a/sqlglot/dataframe/sql/session.py
+++ b/sqlglot/dataframe/sql/session.py
@@ -67,13 +67,20 @@ class SparkSession:
data_expressions = [
exp.Tuple(
- expressions=list(map(lambda x: F.lit(x).expression, row if not isinstance(row, dict) else row.values()))
+ expressions=list(
+ map(
+ lambda x: F.lit(x).expression,
+ row if not isinstance(row, dict) else row.values(),
+ )
+ )
)
for row in data
]
sel_columns = [
- F.col(name).cast(data_type).alias(name).expression if data_type is not None else F.col(name).expression
+ F.col(name).cast(data_type).alias(name).expression
+ if data_type is not None
+ else F.col(name).expression
for name, data_type in column_mapping.items()
]
@@ -106,10 +113,12 @@ class SparkSession:
select_expression.set("with", expression.args.get("with"))
expression.set("with", None)
del expression.args["expression"]
- df = DataFrame(self, select_expression, output_expression_container=expression)
+ df = DataFrame(self, select_expression, output_expression_container=expression) # type: ignore
df = df._convert_leaf_to_cte()
else:
- raise ValueError("Unknown expression type provided in the SQL. Please create an issue with the SQL.")
+ raise ValueError(
+ "Unknown expression type provided in the SQL. Please create an issue with the SQL."
+ )
return df
@property