1
0
Fork 0

Adding upstream version 25.0.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:37:28 +01:00
parent dd3422a695
commit 91ffc387a9
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
84 changed files with 33016 additions and 31040 deletions

View file

@ -29,6 +29,7 @@ from sqlglot.dialects.dialect import (
struct_extract_sql,
time_format,
timestrtotime_sql,
unit_to_str,
var_map_sql,
)
from sqlglot.transforms import (
@ -318,6 +319,7 @@ class Hive(Dialect):
),
"TO_DATE": build_formatted_time(exp.TsOrDsToDate, "hive"),
"TO_JSON": exp.JSONFormat.from_arg_list,
"TRUNC": exp.TimestampTrunc.from_arg_list,
"UNBASE64": exp.FromBase64.from_arg_list,
"UNIX_TIMESTAMP": lambda args: build_formatted_time(exp.StrToUnix, "hive", True)(
args or [exp.CurrentTimestamp()]
@ -415,7 +417,7 @@ class Hive(Dialect):
) -> t.Tuple[t.List[exp.Expression], t.Optional[exp.Expression]]:
return (
(
self._parse_csv(self._parse_conjunction)
self._parse_csv(self._parse_assignment)
if self._match_set({TokenType.PARTITION_BY, TokenType.DISTRIBUTE_BY})
else []
),
@ -548,6 +550,7 @@ class Hive(Dialect):
exp.TimeStrToDate: rename_func("TO_DATE"),
exp.TimeStrToTime: timestrtotime_sql,
exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"),
exp.TimestampTrunc: lambda self, e: self.func("TRUNC", e.this, unit_to_str(e)),
exp.TimeToStr: lambda self, e: self.func("DATE_FORMAT", e.this, self.format_time(e)),
exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"),
exp.ToBase64: rename_func("BASE64"),