Hi, Devs,
    When I try to develop a new connector, which support aggregate push
down. I found that  Flink aggregate pushdown is not user-friendly. The
`AggregateExpression` passed to the connector by
`SupportsAggregatePushDown#applyAggregates` doesn't provide access to
subclasses. This makes it impossible for me to directly determine the type
of agg operator unless I import the planner module, but this is discouraged
and considered a heavyweight action.
    Because I cann't access the subclasses of
`AggregateExpression#FunctionDefinition`, like `CountAggFunction` and am
unable to import the planner module, I'm forced to match the agg operators
using hack way that match fully qualified class names like the following
code:

FunctionDefinition functionDefinition =
aggregateExpressions.get(0).getFunctionDefinition();
if (!(functionDefinition
                .getClass()
                .getCanonicalName()
                .equals(

"org.apache.flink.table.planner.functions.aggfunctions.CountAggFunction")
        || functionDefinition
                .getClass()
                .getCanonicalName()
                .equals(

"org.apache.flink.table.planner.functions.aggfunctions.Count1AggFunction")))
{
    return false;
}


I think the problem may also exist with other SupportsXxxPushDown. Should
we consider which planner classes can be exposed to developers to
facilitate their use?

Yours,
Swuferhong (Yunhong Zheng).

Reply via email to