summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/presto.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
commitc51a9844b869fd7cd69e5cc7658d34f61a865185 (patch)
tree55706c65ce7e19626aabf7ff4dde0e1a51b739db /sqlglot/dialects/presto.py
parentReleasing debian version 18.17.0-1. (diff)
downloadsqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.tar.xz
sqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.zip
Merging upstream version 19.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/presto.py')
-rw-r--r--sqlglot/dialects/presto.py9
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)