diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 13:44:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 13:44:59 +0000 |
commit | ef2db38de92f2329c1c366318bddfc7e3dee8415 (patch) | |
tree | dee41de1eb0e05f2f6805b77df41a71b3aa66ec2 /sqlglot/dialects/hive.py | |
parent | Adding upstream version 11.0.1. (diff) | |
download | sqlglot-ef2db38de92f2329c1c366318bddfc7e3dee8415.tar.xz sqlglot-ef2db38de92f2329c1c366318bddfc7e3dee8415.zip |
Adding upstream version 11.1.3.upstream/11.1.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/hive.py')
-rw-r--r-- | sqlglot/dialects/hive.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py index c558b70..ea1191e 100644 --- a/sqlglot/dialects/hive.py +++ b/sqlglot/dialects/hive.py @@ -43,7 +43,7 @@ def _add_date_sql(self, expression): else expression.expression ) modified_increment = exp.Literal.number(modified_increment) - return f"{func}({self.format_args(expression.this, modified_increment.this)})" + return self.func(func, expression.this, modified_increment.this) def _date_diff_sql(self, expression): @@ -66,7 +66,7 @@ def _property_sql(self, expression): def _str_to_unix(self, expression): - return f"UNIX_TIMESTAMP({self.format_args(expression.this, _time_format(self, expression))})" + return self.func("UNIX_TIMESTAMP", expression.this, _time_format(self, expression)) def _str_to_date(self, expression): @@ -312,7 +312,9 @@ class Hive(Dialect): exp.TsOrDsAdd: lambda self, e: f"DATE_ADD({self.sql(e, 'this')}, {self.sql(e, 'expression')})", exp.TsOrDsToDate: _to_date_sql, exp.TryCast: no_trycast_sql, - exp.UnixToStr: lambda self, e: f"FROM_UNIXTIME({self.format_args(e.this, _time_format(self, e))})", + exp.UnixToStr: lambda self, e: self.func( + "FROM_UNIXTIME", e.this, _time_format(self, e) + ), exp.UnixToTime: rename_func("FROM_UNIXTIME"), exp.UnixToTimeStr: rename_func("FROM_UNIXTIME"), exp.PartitionedByProperty: lambda self, e: f"PARTITIONED BY {self.sql(e, 'this')}", @@ -324,9 +326,9 @@ class Hive(Dialect): PROPERTIES_LOCATION = { **generator.Generator.PROPERTIES_LOCATION, # type: ignore - exp.FileFormatProperty: exp.Properties.Location.POST_SCHEMA_ROOT, - exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA_ROOT, - exp.TableFormatProperty: exp.Properties.Location.POST_SCHEMA_ROOT, + exp.FileFormatProperty: exp.Properties.Location.POST_SCHEMA, + exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, + exp.TableFormatProperty: exp.Properties.Location.POST_SCHEMA, } def with_properties(self, properties): |