[
https://issues.apache.org/jira/browse/CALCITE-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18053753#comment-18053753
]
Julian Hyde edited comment on CALCITE-5787 at 1/23/26 1:01 AM:
---------------------------------------------------------------
Was this code written using AI? I imagine that if a human had written this
code, they would have realized that it was poorly specified.
As I said in CALCITE-5740, the specification is incomplete if it doesn't deal
with a join query like "select e.sal, e.job, d.dname from emp as e join dept as
d on e.deptno = d.deptno", and with a union query.
The lack of specification is obvious. {{RelMetadataQuery.getInputFieldsUsed}}
has one line of javadoc, which is completely inadequate to figure out how to
use the method. To reverse-engineer the specification, I started to read the
tests, and noticed that tests for interesting cases like Join and Union were
either missing or completely wacky.
If a human wrote {{SemiJoinRule.getUsedFields}} they would surely think "hey,
maybe getInputFieldsUsed should return an ImmutableBitSet rather than a
List<ImmutableBitSet>". Which leads me to believe that a human did not write it.
was (Author: julianhyde):
Was this code written using AI? I imagine that if a human had written this
code, they would have realized that it was poorly specified.
As I said in CALCITE-5740, the specification is incomplete if it doesn't deal
with a join query like "select e.sal, e.job, d.dname from emp as e join dept as
d on e.deptno = d.deptno", and with a union query.
The lack of specification is obvious. {{RelMetadataQuery.getInputFieldsUsed}}
has one line of javadoc, which is completely inadequate to figure out how to
use the method. To reverse-engineer the specification, I started to read the
tests, and noticed that tests for interesting cases like Join and Union were
either missing or completely wacky.
If a human wrote {{SemiJoinRule.getUsedFields}} they would surely think "hey,
maybe getInputFieldsUsed should return an ImmutableBitSet rather than a
List<ImmutableBitSet>".
> The RelMdInputFieldsUsed is introduced to track the usage of input fields
> -------------------------------------------------------------------------
>
> Key: CALCITE-5787
> URL: https://issues.apache.org/jira/browse/CALCITE-5787
> Project: Calcite
> Issue Type: New Feature
> Reporter: Rong Rong
> Assignee: Zhen Chen
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.42.0
>
>
> 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)