summaryrefslogtreecommitdiffstats
path: root/sqlglot/expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r--sqlglot/expressions.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 1c0af58..e01cc1a 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -1013,7 +1013,7 @@ class Pragma(Expression):
class Set(Expression):
- arg_types = {"expressions": False}
+ arg_types = {"expressions": False, "unset": False, "tag": False}
class SetItem(Expression):
@@ -1168,10 +1168,6 @@ class RenameTable(Expression):
pass
-class SetTag(Expression):
- arg_types = {"expressions": True, "unset": False}
-
-
class Comment(Expression):
arg_types = {"this": True, "kind": True, "expression": True, "exists": False}
@@ -1934,6 +1930,11 @@ class LanguageProperty(Property):
arg_types = {"this": True}
+# spark ddl
+class ClusteredByProperty(Property):
+ arg_types = {"expressions": True, "sorted_by": False, "buckets": True}
+
+
class DictProperty(Property):
arg_types = {"this": True, "kind": True, "settings": False}
@@ -2074,6 +2075,7 @@ class Properties(Expression):
"ALGORITHM": AlgorithmProperty,
"AUTO_INCREMENT": AutoIncrementProperty,
"CHARACTER SET": CharacterSetProperty,
+ "CLUSTERED_BY": ClusteredByProperty,
"COLLATE": CollateProperty,
"COMMENT": SchemaCommentProperty,
"DEFINER": DefinerProperty,
@@ -2281,6 +2283,12 @@ class Table(Expression):
}
@property
+ def name(self) -> str:
+ if isinstance(self.this, Func):
+ return ""
+ return self.this.name
+
+ @property
def db(self) -> str:
return self.text("db")
@@ -3716,6 +3724,10 @@ class Bracket(Condition):
arg_types = {"this": True, "expressions": True}
+class SafeBracket(Bracket):
+ """Represents array lookup where OOB index yields NULL instead of causing a failure."""
+
+
class Distinct(Expression):
arg_types = {"expressions": False, "on": False}
@@ -3934,7 +3946,7 @@ class Case(Func):
class Cast(Func):
- arg_types = {"this": True, "to": True}
+ arg_types = {"this": True, "to": True, "format": False}
@property
def name(self) -> str:
@@ -4292,6 +4304,10 @@ class Map(Func):
arg_types = {"keys": False, "values": False}
+class MapFromEntries(Func):
+ pass
+
+
class StarMap(Func):
pass