summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/hive.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/hive.py')
-rw-r--r--sqlglot/dialects/hive.py14
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):