Merging upstream version 11.5.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b9525af810
commit
9782c88c58
106 changed files with 25262 additions and 24200 deletions
|
@ -948,12 +948,17 @@ class Column(Condition):
|
|||
return Dot.build(parts)
|
||||
|
||||
|
||||
class ColumnPosition(Expression):
|
||||
arg_types = {"this": False, "position": True}
|
||||
|
||||
|
||||
class ColumnDef(Expression):
|
||||
arg_types = {
|
||||
"this": True,
|
||||
"kind": False,
|
||||
"constraints": False,
|
||||
"exists": False,
|
||||
"position": False,
|
||||
}
|
||||
|
||||
|
||||
|
@ -3290,6 +3295,13 @@ class Anonymous(Func):
|
|||
is_var_len_args = True
|
||||
|
||||
|
||||
# https://docs.snowflake.com/en/sql-reference/functions/hll
|
||||
# https://docs.aws.amazon.com/redshift/latest/dg/r_HLL_function.html
|
||||
class Hll(AggFunc):
|
||||
arg_types = {"this": True, "expressions": False}
|
||||
is_var_len_args = True
|
||||
|
||||
|
||||
class ApproxDistinct(AggFunc):
|
||||
arg_types = {"this": True, "accuracy": False}
|
||||
|
||||
|
@ -3440,6 +3452,10 @@ class CurrentTimestamp(Func):
|
|||
arg_types = {"this": False}
|
||||
|
||||
|
||||
class CurrentUser(Func):
|
||||
arg_types = {"this": False}
|
||||
|
||||
|
||||
class DateAdd(Func, TimeUnit):
|
||||
arg_types = {"this": True, "expression": True, "unit": False}
|
||||
|
||||
|
@ -3647,6 +3663,11 @@ class JSONBExtractScalar(JSONExtract):
|
|||
_sql_names = ["JSONB_EXTRACT_SCALAR"]
|
||||
|
||||
|
||||
class JSONFormat(Func):
|
||||
arg_types = {"this": False, "options": False}
|
||||
_sql_names = ["JSON_FORMAT"]
|
||||
|
||||
|
||||
class Least(Func):
|
||||
arg_types = {"expressions": False}
|
||||
is_var_len_args = True
|
||||
|
@ -3703,14 +3724,9 @@ class VarMap(Func):
|
|||
is_var_len_args = True
|
||||
|
||||
|
||||
class Matches(Func):
|
||||
"""Oracle/Snowflake decode.
|
||||
https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm
|
||||
Pattern matching MATCHES(value, search1, result1, ...searchN, resultN, else)
|
||||
"""
|
||||
|
||||
arg_types = {"this": True, "expressions": True}
|
||||
is_var_len_args = True
|
||||
# https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html
|
||||
class MatchAgainst(Func):
|
||||
arg_types = {"this": True, "expressions": True, "modifier": False}
|
||||
|
||||
|
||||
class Max(AggFunc):
|
||||
|
@ -4989,9 +5005,10 @@ def replace_placeholders(expression, *args, **kwargs):
|
|||
Examples:
|
||||
>>> from sqlglot import exp, parse_one
|
||||
>>> replace_placeholders(
|
||||
... parse_one("select * from :tbl where ? = ?"), "a", "b", tbl="foo"
|
||||
... parse_one("select * from :tbl where ? = ?"),
|
||||
... exp.to_identifier("str_col"), "b", tbl=exp.to_identifier("foo")
|
||||
... ).sql()
|
||||
'SELECT * FROM foo WHERE a = b'
|
||||
"SELECT * FROM foo WHERE str_col = 'b'"
|
||||
|
||||
Returns:
|
||||
The mapped expression.
|
||||
|
@ -5002,10 +5019,10 @@ def replace_placeholders(expression, *args, **kwargs):
|
|||
if node.name:
|
||||
new_name = kwargs.get(node.name)
|
||||
if new_name:
|
||||
return to_identifier(new_name)
|
||||
return convert(new_name)
|
||||
else:
|
||||
try:
|
||||
return to_identifier(next(args))
|
||||
return convert(next(args))
|
||||
except StopIteration:
|
||||
pass
|
||||
return node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue