summaryrefslogtreecommitdiffstats
path: root/sqlglot/expressions.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-16 11:37:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-16 11:37:39 +0000
commitf10d022e11dcd1015db1a74ce9f4198ebdcb7f40 (patch)
treeac7bdc1d214a0f97f991cff14e933f4895ee68e1 /sqlglot/expressions.py
parentReleasing progress-linux version 18.11.6-1. (diff)
downloadsqlglot-f10d022e11dcd1015db1a74ce9f4198ebdcb7f40.tar.xz
sqlglot-f10d022e11dcd1015db1a74ce9f4198ebdcb7f40.zip
Merging upstream version 18.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r--sqlglot/expressions.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 80f1c0f..b94b1e1 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -487,7 +487,7 @@ class Expression(metaclass=_Expression):
"""
for node, _, _ in self.dfs(prune=lambda n, p, *_: p and not type(n) is self.__class__):
if not type(node) is self.__class__:
- yield node.unnest() if unnest else node
+ yield node.unnest() if unnest and not isinstance(node, Subquery) else node
def __str__(self) -> str:
return self.sql()
@@ -2107,7 +2107,7 @@ class LockingProperty(Property):
arg_types = {
"this": False,
"kind": True,
- "for_or_in": True,
+ "for_or_in": False,
"lock_type": True,
"override": False,
}
@@ -3605,6 +3605,9 @@ class DataType(Expression):
TIMESTAMP = auto()
TIMESTAMPLTZ = auto()
TIMESTAMPTZ = auto()
+ TIMESTAMP_S = auto()
+ TIMESTAMP_MS = auto()
+ TIMESTAMP_NS = auto()
TINYINT = auto()
TSMULTIRANGE = auto()
TSRANGE = auto()
@@ -3661,6 +3664,9 @@ class DataType(Expression):
Type.TIMESTAMP,
Type.TIMESTAMPTZ,
Type.TIMESTAMPLTZ,
+ Type.TIMESTAMP_S,
+ Type.TIMESTAMP_MS,
+ Type.TIMESTAMP_NS,
Type.DATE,
Type.DATETIME,
Type.DATETIME64,
@@ -4286,7 +4292,7 @@ class Case(Func):
class Cast(Func):
- arg_types = {"this": True, "to": True, "format": False}
+ arg_types = {"this": True, "to": True, "format": False, "safe": False}
@property
def name(self) -> str:
@@ -4538,6 +4544,18 @@ class Explode(Func):
pass
+class ExplodeOuter(Explode):
+ pass
+
+
+class Posexplode(Explode):
+ pass
+
+
+class PosexplodeOuter(Posexplode):
+ pass
+
+
class Floor(Func):
arg_types = {"this": True, "decimals": False}
@@ -4621,14 +4639,18 @@ class JSONArrayAgg(Func):
# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html
# Note: parsing of JSON column definitions is currently incomplete.
class JSONColumnDef(Expression):
- arg_types = {"this": True, "kind": False, "path": False}
+ arg_types = {"this": False, "kind": False, "path": False, "nested_schema": False}
+
+
+class JSONSchema(Expression):
+ arg_types = {"expressions": True}
# # https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html
class JSONTable(Func):
arg_types = {
"this": True,
- "expressions": True,
+ "schema": True,
"path": False,
"error_handling": False,
"empty_handling": False,
@@ -4790,10 +4812,6 @@ class Nvl2(Func):
arg_types = {"this": True, "true": True, "false": False}
-class Posexplode(Func):
- pass
-
-
# https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict#mlpredict_function
class Predict(Func):
arg_types = {"this": True, "expression": True, "params_struct": False}