1
0
Fork 0

Merging upstream version 21.1.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:27:51 +01:00
parent 4e41aa0bbb
commit bf03050a25
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
91 changed files with 49165 additions and 47854 deletions

View file

@ -1090,6 +1090,11 @@ class Create(DDL):
"clone": False,
}
@property
def kind(self) -> t.Optional[str]:
kind = self.args.get("kind")
return kind and kind.upper()
# https://docs.snowflake.com/en/sql-reference/sql/create-clone
# https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_clone_statement
@ -4626,6 +4631,11 @@ class CountIf(AggFunc):
_sql_names = ["COUNT_IF", "COUNTIF"]
# cube root
class Cbrt(Func):
pass
class CurrentDate(Func):
arg_types = {"this": False}
@ -4728,7 +4738,7 @@ class Extract(Func):
class Timestamp(Func):
arg_types = {"this": False, "expression": False}
arg_types = {"this": False, "expression": False, "with_tz": False}
class TimestampAdd(Func, TimeUnit):
@ -4833,7 +4843,7 @@ class Posexplode(Explode):
pass
class PosexplodeOuter(Posexplode):
class PosexplodeOuter(Posexplode, ExplodeOuter):
pass
@ -4868,6 +4878,7 @@ class Xor(Connector, Func):
class If(Func):
arg_types = {"this": True, "true": True, "false": False}
_sql_names = ["IF", "IIF"]
class Nullif(Func):
@ -6883,6 +6894,7 @@ def replace_tables(
table = to_table(
new_name,
**{k: v for k, v in node.args.items() if k not in TABLE_PARTS},
dialect=dialect,
)
table.add_comments([original])
return table
@ -7072,6 +7084,60 @@ def cast_unless(
return cast(expr, to, **opts)
def array(
*expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs
) -> Array:
"""
Returns an array.
Examples:
>>> array(1, 'x').sql()
'ARRAY(1, x)'
Args:
expressions: the expressions to add to the array.
copy: whether or not to copy the argument expressions.
dialect: the source dialect.
kwargs: the kwargs used to instantiate the function of interest.
Returns:
An array expression.
"""
return Array(
expressions=[
maybe_parse(expression, copy=copy, dialect=dialect, **kwargs)
for expression in expressions
]
)
def tuple_(
*expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs
) -> Tuple:
"""
Returns an tuple.
Examples:
>>> tuple_(1, 'x').sql()
'(1, x)'
Args:
expressions: the expressions to add to the tuple.
copy: whether or not to copy the argument expressions.
dialect: the source dialect.
kwargs: the kwargs used to instantiate the function of interest.
Returns:
A tuple expression.
"""
return Tuple(
expressions=[
maybe_parse(expression, copy=copy, dialect=dialect, **kwargs)
for expression in expressions
]
)
def true() -> Boolean:
"""
Returns a true Boolean expression.