bug: can't handle aggregates within other value operations #507
Open
Description
What happened?
We're handling certain aggregate functions incorrectly.
If the aggregate is within a separate ValueOp, like the below somecol.sum() / sumcol.sum()
then we hit
TypeError: Parameter to MergeFrom() must be instance of same class: expected substrait.ibis.Expression got substrait.ibis.AggregateFunction.
because we're recursing down into the expression, but the AggregateRel needs to be handled outside of the current expression (i'm not exactly sure how at this point)
Here's a failing test case:
def test_value_op_aggregate(compiler):
t = ibis.table([("a", "float"), ("b", "int32")], name="t")
expr = t.aggregate(mkt_share=t.a.sum() / t.b.sum())
result = translate(expr, compiler)
assert result
What version of ibis-substrait are you using?
2.21.0
What substrait consumer(s) are you using, if any?
No response
Relevant log output
No response
Metadata
Assignees
Labels
Type
Projects
Status
backlog