[ 
https://issues.apache.org/jira/browse/CALCITE-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041008#comment-18041008
 ] 

Zhen Chen commented on CALCITE-5787:
------------------------------------

Thank you very much for reply [~zabetak] . Indeed, the implementation in 
RelFieldTrimmeris very close to the requirements of this interface. I've also 
revisited the code, and it seems that only *Project* and *Aggregate* operators 
require special handling when extracting the used column references from their 
inputs. The discussion also mentioned that two methods have already been 
implemented for this. I'm wondering if we still need to implement a completely 
new set of interfaces for this capability? If so, I agree that using a single 
class (perhaps as a form of metadata) would be an ideal approach.
Another point I'm still unclear about: the RelFieldTrimmer uses a single 
ImmutableBitSet to perform top-down column pruning. When it reaches a *Join* 
node, it simply passes the set down to its two inputs. However, based on the 
description in the JIRA ticket, for a *Join* operator, we need to obtain the 
column indices it uses from each of its inputs. Therefore, I don't think a 
single ImmutableBitSet is sufficient to represent this requirement.

> 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)

Reply via email to