summaryrefslogtreecommitdiffstats
path: root/sqlglot/executor/env.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/executor/env.py')
-rw-r--r--sqlglot/executor/env.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sqlglot/executor/env.py b/sqlglot/executor/env.py
index b79a551..6c01edc 100644
--- a/sqlglot/executor/env.py
+++ b/sqlglot/executor/env.py
@@ -132,11 +132,10 @@ def ordered(this, desc, nulls_first):
@null_if_any
def interval(this, unit):
- unit = unit.lower()
- plural = unit + "s"
+ plural = unit + "S"
if plural in Generator.TIME_PART_SINGULARS:
unit = plural
- return datetime.timedelta(**{unit: float(this)})
+ return datetime.timedelta(**{unit.lower(): float(this)})
@null_if_any("this", "expression")
@@ -176,6 +175,7 @@ ENV = {
"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)),
+ "GETPATH": null_if_any(lambda this, e: this.get(e)),
"GT": null_if_any(lambda this, e: this > e),
"GTE": null_if_any(lambda this, e: this >= e),
"IF": lambda predicate, true, false: true if predicate else false,