Skip to content

Commit

Permalink
Feat: add dot to executor closes tobymao#1676
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao authored and adrianisk committed Jun 21, 2023
1 parent 1fc715e commit 7d00300
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlglot/executor/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def interval(this, unit):
"CONCAT": null_if_any(lambda *args: "".join(args)),
"CONCATWS": null_if_any(lambda this, *args: this.join(args)),
"DIV": null_if_any(lambda e, this: e / this),
"DOT": null_if_any(lambda e, this: e[this]),
"EQ": null_if_any(lambda this, e: this == e),
"EXTRACT": null_if_any(lambda this, e: getattr(e, this)),
"GT": null_if_any(lambda this, e: this > e),
Expand All @@ -167,6 +168,7 @@ def interval(this, unit):
"LOWER": null_if_any(lambda arg: arg.lower()),
"LT": null_if_any(lambda this, e: this < e),
"LTE": null_if_any(lambda this, e: this <= e),
"MAP": null_if_any(lambda k, v: dict(zip(k, v))),
"MOD": null_if_any(lambda e, this: e % this),
"MUL": null_if_any(lambda e, this: e * this),
"NEQ": null_if_any(lambda this, e: this != e),
Expand Down
1 change: 1 addition & 0 deletions tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ def test_scalar_functions(self):
("YEAR(CURRENT_DATE()) <> (YEAR(CURRENT_DATE()))", False),
("1::bool", True),
("0::bool", False),
("MAP(['a'], [1]).a", 1),
]:
with self.subTest(sql):
result = execute(f"SELECT {sql}")
Expand Down

0 comments on commit 7d00300

Please sign in to comment.