diff options
Diffstat (limited to 'sqlglot/dialects/presto.py')
-rw-r--r-- | sqlglot/dialects/presto.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sqlglot/dialects/presto.py b/sqlglot/dialects/presto.py index aac368c..ded3655 100644 --- a/sqlglot/dialects/presto.py +++ b/sqlglot/dialects/presto.py @@ -36,7 +36,6 @@ def _approx_distinct_sql(self: Presto.Generator, expression: exp.ApproxDistinct) def _explode_to_unnest_sql(self: Presto.Generator, expression: exp.Lateral) -> str: if isinstance(expression.this, exp.Explode): - expression = expression.copy() return self.sql( exp.Join( this=exp.Unnest( @@ -72,7 +71,6 @@ def _schema_sql(self: Presto.Generator, expression: exp.Schema) -> str: for schema in expression.parent.find_all(exp.Schema): column_defs = schema.find_all(exp.ColumnDef) if column_defs and isinstance(schema.parent, exp.Property): - expression = expression.copy() expression.expressions.extend(column_defs) return self.schema_sql(expression) @@ -407,12 +405,10 @@ class Presto(Dialect): target_type = None if target_type and target_type.is_type("timestamp"): - to = target_type.copy() - if target_type is start.to: - end = exp.cast(end, to) + end = exp.cast(end, target_type) else: - start = exp.cast(start, to) + start = exp.cast(start, target_type) return self.func("SEQUENCE", start, end, step) @@ -432,6 +428,5 @@ class Presto(Dialect): kind = expression.args["kind"] schema = expression.this if kind == "VIEW" and schema.expressions: - expression = expression.copy() expression.this.set("expressions", None) return super().create_sql(expression) |