summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/hive.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:44:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:44:41 +0000
commit376de8b6892deca7dc5d83035c047f1e13eb67ea (patch)
tree334a1753cd914294aa99128fac3fb59bf14dc10f /sqlglot/dialects/hive.py
parentReleasing debian version 20.9.0-1. (diff)
downloadsqlglot-376de8b6892deca7dc5d83035c047f1e13eb67ea.tar.xz
sqlglot-376de8b6892deca7dc5d83035c047f1e13eb67ea.zip
Merging upstream version 20.11.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/hive.py')
-rw-r--r--sqlglot/dialects/hive.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py
index dffa41e..060f9bd 100644
--- a/sqlglot/dialects/hive.py
+++ b/sqlglot/dialects/hive.py
@@ -397,9 +397,11 @@ class Hive(Dialect):
if this and not schema:
return this.transform(
- lambda node: node.replace(exp.DataType.build("text"))
- if isinstance(node, exp.DataType) and node.is_type("char", "varchar")
- else node,
+ lambda node: (
+ node.replace(exp.DataType.build("text"))
+ if isinstance(node, exp.DataType) and node.is_type("char", "varchar")
+ else node
+ ),
copy=False,
)
@@ -409,9 +411,11 @@ class Hive(Dialect):
self,
) -> t.Tuple[t.List[exp.Expression], t.Optional[exp.Expression]]:
return (
- self._parse_csv(self._parse_conjunction)
- if self._match_set({TokenType.PARTITION_BY, TokenType.DISTRIBUTE_BY})
- else [],
+ (
+ self._parse_csv(self._parse_conjunction)
+ if self._match_set({TokenType.PARTITION_BY, TokenType.DISTRIBUTE_BY})
+ else []
+ ),
super()._parse_order(skip_order_token=self._match(TokenType.SORT_BY)),
)
@@ -483,9 +487,9 @@ class Hive(Dialect):
exp.MD5Digest: lambda self, e: self.func("UNHEX", self.func("MD5", e.this)),
exp.Min: min_or_least,
exp.MonthsBetween: lambda self, e: self.func("MONTHS_BETWEEN", e.this, e.expression),
- exp.NotNullColumnConstraint: lambda self, e: ""
- if e.args.get("allow_null")
- else "NOT NULL",
+ exp.NotNullColumnConstraint: lambda self, e: (
+ "" if e.args.get("allow_null") else "NOT NULL"
+ ),
exp.VarMap: var_map_sql,
exp.Create: _create_sql,
exp.Quantile: rename_func("PERCENTILE"),