Adding upstream version 18.7.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c4fc25c23b
commit
be16920347
96 changed files with 59037 additions and 52828 deletions
|
@ -111,7 +111,7 @@ def _array_sort_sql(self: Hive.Generator, expression: exp.ArraySort) -> str:
|
|||
|
||||
|
||||
def _property_sql(self: Hive.Generator, expression: exp.Property) -> str:
|
||||
return f"'{expression.name}'={self.sql(expression, 'value')}"
|
||||
return f"{self.property_name(expression, string_key=True)}={self.sql(expression, 'value')}"
|
||||
|
||||
|
||||
def _str_to_unix_sql(self: Hive.Generator, expression: exp.StrToUnix) -> str:
|
||||
|
@ -413,7 +413,7 @@ class Hive(Dialect):
|
|||
exp.DiToDate: lambda self, e: f"TO_DATE(CAST({self.sql(e, 'this')} AS STRING), {Hive.DATEINT_FORMAT})",
|
||||
exp.FileFormatProperty: lambda self, e: f"STORED AS {self.sql(e, 'this') if isinstance(e.this, exp.InputOutputFormat) else e.name.upper()}",
|
||||
exp.FromBase64: rename_func("UNBASE64"),
|
||||
exp.If: if_sql,
|
||||
exp.If: if_sql(),
|
||||
exp.ILike: no_ilike_sql,
|
||||
exp.IsNan: rename_func("ISNAN"),
|
||||
exp.JSONExtract: rename_func("GET_JSON_OBJECT"),
|
||||
|
@ -466,6 +466,11 @@ class Hive(Dialect):
|
|||
exp.NumberToStr: rename_func("FORMAT_NUMBER"),
|
||||
exp.LastDateOfMonth: rename_func("LAST_DAY"),
|
||||
exp.National: lambda self, e: self.national_sql(e, prefix=""),
|
||||
exp.ClusteredColumnConstraint: lambda self, e: f"({self.expressions(e, 'this', indent=False)})",
|
||||
exp.NonClusteredColumnConstraint: lambda self, e: f"({self.expressions(e, 'this', indent=False)})",
|
||||
exp.NotForReplicationColumnConstraint: lambda self, e: "",
|
||||
exp.OnProperty: lambda self, e: "",
|
||||
exp.PrimaryKeyColumnConstraint: lambda self, e: "PRIMARY KEY",
|
||||
}
|
||||
|
||||
PROPERTIES_LOCATION = {
|
||||
|
@ -475,6 +480,35 @@ class Hive(Dialect):
|
|||
exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED,
|
||||
}
|
||||
|
||||
def parameter_sql(self, expression: exp.Parameter) -> str:
|
||||
this = self.sql(expression, "this")
|
||||
parent = expression.parent
|
||||
|
||||
if isinstance(parent, exp.EQ) and isinstance(parent.parent, exp.SetItem):
|
||||
# We need to produce SET key = value instead of SET ${key} = value
|
||||
return this
|
||||
|
||||
return f"${{{this}}}"
|
||||
|
||||
def schema_sql(self, expression: exp.Schema) -> str:
|
||||
expression = expression.copy()
|
||||
|
||||
for ordered in expression.find_all(exp.Ordered):
|
||||
if ordered.args.get("desc") is False:
|
||||
ordered.set("desc", None)
|
||||
|
||||
return super().schema_sql(expression)
|
||||
|
||||
def constraint_sql(self, expression: exp.Constraint) -> str:
|
||||
expression = expression.copy()
|
||||
|
||||
for prop in list(expression.find_all(exp.Properties)):
|
||||
prop.pop()
|
||||
|
||||
this = self.sql(expression, "this")
|
||||
expressions = self.expressions(expression, sep=" ", flat=True)
|
||||
return f"CONSTRAINT {this} {expressions}"
|
||||
|
||||
def rowformatserdeproperty_sql(self, expression: exp.RowFormatSerdeProperty) -> str:
|
||||
serde_props = self.sql(expression, "serde_properties")
|
||||
serde_props = f" {serde_props}" if serde_props else ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue