mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix(pinot): DATE_SUB function (#35426)
This commit is contained in:
@@ -59,6 +59,11 @@ class Pinot(MySQL):
|
||||
expression=seq_get(args, 1),
|
||||
unit=seq_get(args, 0),
|
||||
),
|
||||
"DATE_SUB": lambda args: exp.DateSub(
|
||||
this=seq_get(args, 2),
|
||||
expression=seq_get(args, 1),
|
||||
unit=seq_get(args, 0),
|
||||
),
|
||||
}
|
||||
|
||||
class Generator(MySQL.Generator):
|
||||
@@ -97,6 +102,12 @@ class Pinot(MySQL):
|
||||
e.args.get("expression"),
|
||||
e.this,
|
||||
),
|
||||
exp.DateSub: lambda self, e: self.func(
|
||||
"DATE_SUB",
|
||||
exp.Literal.string(str(e.args.get("unit").name)),
|
||||
e.args.get("expression"),
|
||||
e.this,
|
||||
),
|
||||
}
|
||||
# Remove DATE_TRUNC transformation - Pinot supports standard SQL DATE_TRUNC
|
||||
TRANSFORMS.pop(exp.DateTrunc, None)
|
||||
|
||||
Reference in New Issue
Block a user