Adding upstream version 23.12.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
efe1f986ea
commit
5d33af745d
93 changed files with 55455 additions and 52777 deletions
sqlglot/dialects
|
@ -33,10 +33,9 @@ def _build_datetime(
|
|||
) -> t.Callable[[t.List], exp.Func]:
|
||||
def _builder(args: t.List) -> exp.Func:
|
||||
value = seq_get(args, 0)
|
||||
int_value = value is not None and is_int(value.name)
|
||||
|
||||
if isinstance(value, exp.Literal):
|
||||
int_value = is_int(value.this)
|
||||
|
||||
# Converts calls like `TO_TIME('01:02:03')` into casts
|
||||
if len(args) == 1 and value.is_string and not int_value:
|
||||
return exp.cast(value, kind)
|
||||
|
@ -49,7 +48,7 @@ def _build_datetime(
|
|||
if not is_float(value.this):
|
||||
return build_formatted_time(exp.StrToTime, "snowflake")(args)
|
||||
|
||||
if len(args) == 2 and kind == exp.DataType.Type.DATE:
|
||||
if kind == exp.DataType.Type.DATE and not int_value:
|
||||
formatted_exp = build_formatted_time(exp.TsOrDsToDate, "snowflake")(args)
|
||||
formatted_exp.set("safe", safe)
|
||||
return formatted_exp
|
||||
|
@ -749,6 +748,7 @@ class Snowflake(Dialect):
|
|||
|
||||
TRANSFORMS = {
|
||||
**generator.Generator.TRANSFORMS,
|
||||
exp.ApproxDistinct: rename_func("APPROX_COUNT_DISTINCT"),
|
||||
exp.ArgMax: rename_func("MAX_BY"),
|
||||
exp.ArgMin: rename_func("MIN_BY"),
|
||||
exp.Array: inline_array_sql,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue