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

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

Thanks for reply [~julianhyde] , I refered this to Jira. Link is 
[here|https://lists.apache.org/thread/dc6ltroydhl05zn1jcpt85l4b5lwpzyr].
{quote}Why can we not return a single bit set? We don’t traditionally return 
one bit set per input.
{quote}
I noticed that in CALCITE-5740 you suggested implementing the {{ImmutableBitSet 
getInputFieldsUsed() }}interface. However, I found that for operators with 
multiple inputs like JOIN, each child operator numbers its outputs starting 
from 0. Using a single {{ImmutableBitSet }}doesn't seem to properly preserve 
and distinguish between these different input sources.
{quote}Why does this need to be a new API in RelNode? Could this not be done 
vis metadata?
{quote}
Regarding this issue, my initial thought was that similar to {{{}getInputs{}}}, 
we should be able to easily obtain the columns required by the current operator 
from its inputs at the RelNode level. I also noticed some discussions in 
CALCITE-5740 about implementing this interface at the RelNode level, if I 
understand correctly. Of course, implementing it via metadata is also a good 
alternative. Are you more inclined towards using metadata for this? I observed 
that there doesn't seem to be an existing implementation for this in the 
current metadata. I might lean towards implementing such an interface in 
RelNode (although my current draft needs refinement, and [~mbudiu]  has given 
me many suggestions that require refactoring).
{quote}Would this method overlap with existing metadata or methods? If so, how 
do we ensure that they remain consistent.
{quote}
If I understand correctly, you're referring to the 
{{RelOptUtil.getAllFields(aggregateNode) }}and 
{{RelOptUtil.InputFinder.bits(projectNode.getProjects()) }}methods. I need to 
carefully verify these and ensure consistent behavior.

> 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