datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

add `PhysicalExpr` to support, Selective Aggregates feature using `FILTER` clause

Open poonai opened this issue 3 years ago • 1 comments

Which issue does this PR close?

#2214

Add support for adding filter to aggregation.

eg: AGGREGATE(input) FILTER (WHERE condition)

Closes #2214

What changes are included in this PR?

  • ExprWithFilter is added so that expr can be evaluated based on the given filter.
  • ExprWithFilter is used in aggregate functions if it contains filter
  • filtered column name will be added to the TableScan's projection by making expression visitors to visit aggregate function filters

poonai avatar Sep 14 '22 08:09 poonai

@andygrove it's done. Please have a look and let me know :)

poonai avatar Sep 15 '22 08:09 poonai

I am not sure what the current status of this PR is and it is not passing CI, so marking it as "draft" -- please mark it as ready for review when it is

alamb avatar Oct 12 '22 18:10 alamb

@alamb I've fixed the test. Yes, it's ready for review.

poonai avatar Oct 13 '22 07:10 poonai

@alamb PTAL when you can. LGTM but I have not been working so closely with physical execution lately.

andygrove avatar Oct 18 '22 14:10 andygrove

I am sorry I don't have time to review this PR 😭

alamb avatar Nov 02 '22 18:11 alamb

Hey @alamb

No worries, I’ll close this for now. We can rework this when this is relevant again or someone can take this work again and patch it

poonai avatar Nov 03 '22 12:11 poonai

Thanks and sorry @poonai

alamb avatar Nov 03 '22 12:11 alamb