Adding upstream version 25.31.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
44a4f87ffd
commit
ec2e441f55
68 changed files with 58911 additions and 55752 deletions
sqlglot
|
@ -301,7 +301,7 @@ class Expression(metaclass=_Expression):
|
|||
"""
|
||||
return deepcopy(self)
|
||||
|
||||
def add_comments(self, comments: t.Optional[t.List[str]] = None) -> None:
|
||||
def add_comments(self, comments: t.Optional[t.List[str]] = None, prepend: bool = False) -> None:
|
||||
if self.comments is None:
|
||||
self.comments = []
|
||||
|
||||
|
@ -313,7 +313,12 @@ class Expression(metaclass=_Expression):
|
|||
k, *v = kv.split("=")
|
||||
value = v[0].strip() if v else True
|
||||
self.meta[k.strip()] = value
|
||||
self.comments.append(comment)
|
||||
|
||||
if not prepend:
|
||||
self.comments.append(comment)
|
||||
|
||||
if prepend:
|
||||
self.comments = comments + self.comments
|
||||
|
||||
def pop_comments(self) -> t.List[str]:
|
||||
comments = self.comments or []
|
||||
|
@ -5455,6 +5460,10 @@ class ConcatWs(Concat):
|
|||
_sql_names = ["CONCAT_WS"]
|
||||
|
||||
|
||||
class Contains(Func):
|
||||
arg_types = {"this": True, "expression": True}
|
||||
|
||||
|
||||
# https://docs.oracle.com/cd/B13789_01/server.101/b10759/operators004.htm#i1035022
|
||||
class ConnectByRoot(Func):
|
||||
pass
|
||||
|
@ -5584,6 +5593,17 @@ class MonthsBetween(Func):
|
|||
arg_types = {"this": True, "expression": True, "roundoff": False}
|
||||
|
||||
|
||||
class MakeInterval(Func):
|
||||
arg_types = {
|
||||
"year": False,
|
||||
"month": False,
|
||||
"day": False,
|
||||
"hour": False,
|
||||
"minute": False,
|
||||
"second": False,
|
||||
}
|
||||
|
||||
|
||||
class LastDay(Func, TimeUnit):
|
||||
_sql_names = ["LAST_DAY", "LAST_DAY_OF_MONTH"]
|
||||
arg_types = {"this": True, "unit": False}
|
||||
|
@ -5812,6 +5832,11 @@ class IsNan(Func):
|
|||
_sql_names = ["IS_NAN", "ISNAN"]
|
||||
|
||||
|
||||
# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#int64_for_json
|
||||
class Int64(Func):
|
||||
pass
|
||||
|
||||
|
||||
class IsInf(Func):
|
||||
_sql_names = ["IS_INF", "ISINF"]
|
||||
|
||||
|
@ -6304,7 +6329,7 @@ class Round(Func):
|
|||
|
||||
|
||||
class RowNumber(Func):
|
||||
arg_types: t.Dict[str, t.Any] = {}
|
||||
arg_types = {"this": False}
|
||||
|
||||
|
||||
class SafeDivide(Func):
|
||||
|
@ -6490,6 +6515,10 @@ class TsOrDsToDate(Func):
|
|||
arg_types = {"this": True, "format": False, "safe": False}
|
||||
|
||||
|
||||
class TsOrDsToDatetime(Func):
|
||||
pass
|
||||
|
||||
|
||||
class TsOrDsToTime(Func):
|
||||
pass
|
||||
|
||||
|
@ -6947,7 +6976,15 @@ def _combine(
|
|||
return this
|
||||
|
||||
|
||||
def _wrap(expression: E, kind: t.Type[Expression]) -> E | Paren:
|
||||
@t.overload
|
||||
def _wrap(expression: None, kind: t.Type[Expression]) -> None: ...
|
||||
|
||||
|
||||
@t.overload
|
||||
def _wrap(expression: E, kind: t.Type[Expression]) -> E | Paren: ...
|
||||
|
||||
|
||||
def _wrap(expression: t.Optional[E], kind: t.Type[Expression]) -> t.Optional[E] | Paren:
|
||||
return Paren(this=expression) if isinstance(expression, kind) else expression
|
||||
|
||||
|
||||
|
@ -7793,8 +7830,8 @@ def cast(
|
|||
existing_cast_type: DataType.Type = expr.to.this
|
||||
new_cast_type: DataType.Type = data_type.this
|
||||
types_are_equivalent = type_mapping.get(
|
||||
existing_cast_type, existing_cast_type
|
||||
) == type_mapping.get(new_cast_type, new_cast_type)
|
||||
existing_cast_type, existing_cast_type.value
|
||||
) == type_mapping.get(new_cast_type, new_cast_type.value)
|
||||
if expr.is_type(data_type) or types_are_equivalent:
|
||||
return expr
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue