Adding upstream version 26.0.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2ebe732d69
commit
522374f608
57 changed files with 26226 additions and 25977 deletions
|
@ -107,6 +107,13 @@ def _build_date_time_add(expr_type: t.Type[E]) -> t.Callable[[t.List], E]:
|
|||
return _builder
|
||||
|
||||
|
||||
def _build_bitor(args: t.List) -> exp.BitwiseOr | exp.Anonymous:
|
||||
if len(args) == 3:
|
||||
return exp.Anonymous(this="BITOR", expressions=args)
|
||||
|
||||
return binary_from_function(exp.BitwiseOr)(args)
|
||||
|
||||
|
||||
# https://docs.snowflake.com/en/sql-reference/functions/div0
|
||||
def _build_if_from_div0(args: t.List) -> exp.If:
|
||||
lhs = exp._wrap(seq_get(args, 0), exp.Binary)
|
||||
|
@ -393,6 +400,8 @@ class Snowflake(Dialect):
|
|||
),
|
||||
"BITXOR": binary_from_function(exp.BitwiseXor),
|
||||
"BIT_XOR": binary_from_function(exp.BitwiseXor),
|
||||
"BITOR": _build_bitor,
|
||||
"BIT_OR": _build_bitor,
|
||||
"BOOLXOR": binary_from_function(exp.Xor),
|
||||
"DATE": _build_datetime("DATE", exp.DataType.Type.DATE),
|
||||
"DATE_TRUNC": _date_trunc_to_time,
|
||||
|
@ -790,6 +799,14 @@ class Snowflake(Dialect):
|
|||
|
||||
return this
|
||||
|
||||
def _parse_foreign_key(self) -> exp.ForeignKey:
|
||||
# inlineFK, the REFERENCES columns are implied
|
||||
if self._match(TokenType.REFERENCES, advance=False):
|
||||
return self.expression(exp.ForeignKey)
|
||||
|
||||
# outoflineFK, explicitly names the columns
|
||||
return super()._parse_foreign_key()
|
||||
|
||||
class Tokenizer(tokens.Tokenizer):
|
||||
STRING_ESCAPES = ["\\", "'"]
|
||||
HEX_STRINGS = [("x'", "'"), ("X'", "'")]
|
||||
|
@ -869,6 +886,7 @@ class Snowflake(Dialect):
|
|||
"CONVERT_TIMEZONE", e.args.get("zone"), e.this
|
||||
),
|
||||
exp.BitwiseXor: rename_func("BITXOR"),
|
||||
exp.BitwiseOr: rename_func("BITOR"),
|
||||
exp.Create: transforms.preprocess([_flatten_structured_types_unless_iceberg]),
|
||||
exp.DateAdd: date_delta_sql("DATEADD"),
|
||||
exp.DateDiff: date_delta_sql("DATEDIFF"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue