[
https://issues.apache.org/jira/browse/CALCITE-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041001#comment-18041001
]
Stamatis Zampetakis commented on CALCITE-5787:
----------------------------------------------
If I understand the requirements correctly then it seems like the
implementation for this interface already exists inside the RelFieldTrimmer.
Note for instance the similarity between:
*
[RelFieldTrimmer.trimFields(Aggregate)|https://github.com/apache/calcite/blob/abd7ca25943513716d1ba2b592107e2e3f01cb46/core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java#L1068]
*
[RelOptUtil.getAllFields|https://github.com/apache/calcite/blob/abd7ca25943513716d1ba2b592107e2e3f01cb46/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L968]
The RelFieldTrimmer also demonstrates how a single ImmutableBitSet can be used
to provide the necessary information for all inputs.
In fact, if we decide that we want/need a separate interface probably we could
extract all the necessary implementation from the trimmer and make the latter
call that interface.
At first glance, it seems better to model this using metadata providers instead
of an API attached to RelNode interface. From an implementation perspective it
would be also closer to what we have today where the entire code is lying
inside a single class (RelFieldTrimmer).
> Add interface in RelNode for getInputFieldsUsed
> -----------------------------------------------
>
> Key: CALCITE-5787
> URL: https://issues.apache.org/jira/browse/CALCITE-5787
> Project: Calcite
> Issue Type: New Feature
> Reporter: Rong Rong
> Priority: Major
> Labels: pull-request-available
>
> It would be super useful to detect all the input fields used in a {{RelNode}}
> to indicate what's being used from the inputs.
> We have a similar utility to find all input fields referenced for a
> {{RexNode}} via {{RelOptUtil.InputFinder}}. For a relation we can do one step
> further to automatically keep track of all the relevant relations.
> For example,
> - {{Aggregate}} relations: {{RelNode.getInputFieldsUsed}} should return a
> union of the input fields used by {{groupSet}} and all {{aggregateCall}}
> - for each {{aggregateCall}}, we should include all fields used in
> {{{}argList{}}}, {{{}filterArg{}}}, {{{}distinctKeys{}}}, and
> {{{}collation{}}}.
> see relative discussion in CALCITE-5740
--
This message was sent by Atlassian Jira
(v8.20.10#820010)