1
0
Fork 0

Adding upstream version 26.1.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:59:41 +01:00
parent 09521056ff
commit d908bee480
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
119 changed files with 71635 additions and 68059 deletions

View file

@ -59,6 +59,7 @@ class _Expression(type):
SQLGLOT_META = "sqlglot.meta"
SQLGLOT_ANONYMOUS = "sqlglot.anonymous"
TABLE_PARTS = ("this", "db", "catalog")
COLUMN_PARTS = ("this", "table", "db", "catalog")
@ -2290,6 +2291,7 @@ class OnConflict(Expression):
"action": False,
"conflict_keys": False,
"constraint": False,
"where": False,
}
@ -3271,12 +3273,12 @@ class Table(Expression):
return parts
def to_column(self, copy: bool = True) -> Alias | Column | Dot:
def to_column(self, copy: bool = True) -> Expression:
parts = self.parts
last_part = parts[-1]
if isinstance(last_part, Identifier):
col = column(*reversed(parts[0:4]), fields=parts[4:], copy=copy) # type: ignore
col: Expression = column(*reversed(parts[0:4]), fields=parts[4:], copy=copy) # type: ignore
else:
# This branch will be reached if a function or array is wrapped in a `Table`
col = last_part
@ -4243,6 +4245,7 @@ class Pivot(Expression):
"columns": False,
"include_nulls": False,
"default_on_null": False,
"into": False,
}
@property
@ -4250,6 +4253,12 @@ class Pivot(Expression):
return bool(self.args.get("unpivot"))
# https://duckdb.org/docs/sql/statements/unpivot#simplified-unpivot-syntax
# UNPIVOT ... INTO [NAME <col_name> VALUE <col_value>][...,]
class UnpivotColumns(Expression):
arg_types = {"this": True, "expressions": True}
class Window(Condition):
arg_types = {
"this": True,
@ -5882,6 +5891,10 @@ class Initcap(Func):
arg_types = {"this": True, "expression": False}
class IsAscii(Func):
pass
class IsNan(Func):
_sql_names = ["IS_NAN", "ISNAN"]
@ -6140,8 +6153,8 @@ class Right(Func):
class Length(Func):
arg_types = {"this": True, "binary": False}
_sql_names = ["LENGTH", "LEN"]
arg_types = {"this": True, "binary": False, "encoding": False}
_sql_names = ["LENGTH", "LEN", "CHAR_LENGTH", "CHARACTER_LENGTH"]
class Levenshtein(Func):
@ -6590,6 +6603,10 @@ class Unhex(Func):
pass
class Unicode(Func):
pass
# https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#unix_date
class UnixDate(Func):
pass
@ -7375,11 +7392,10 @@ def merge(
Returns:
Merge: The syntax tree for the MERGE statement.
"""
expressions = []
expressions: t.List[Expression] = []
for when_expr in when_exprs:
expressions.extend(
maybe_parse(when_expr, dialect=dialect, copy=copy, into=Whens, **opts).expressions
)
expression = maybe_parse(when_expr, dialect=dialect, copy=copy, into=Whens, **opts)
expressions.extend([expression] if isinstance(expression, When) else expression.expressions)
merge = Merge(
this=maybe_parse(into, dialect=dialect, copy=copy, **opts),