You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jess Balint <jb...@gmail.com> on 2017/01/17 15:31:17 UTC

ProjectRemoveRule checking RelNode type

Hi,
I used ProjectRemoveRule, but it's not working. When debugging, I arrive at
this code:

Project project = call.rel(0);
RelNode stripped = project.getInput();
if (stripped instanceof Project) {

The *stripped* object here is an instance of *HepRelVertex* and therefore
this code does not recognize the child as a projection and loses the field
names. How should this be reconciled?

Thanks.
Jess

Re: ProjectRemoveRule checking RelNode type

Posted by Julian Hyde <jh...@apache.org>.
ProjectRemoveRule currently takes one argument (the trivial project)
but to see the real type of that project's input the rule would need
to take two arguments.

It looks as if Vladimir added the functionality in
https://issues.apache.org/jira/browse/CALCITE-92 but it was not
properly tested. I ran the whole test test suite and found that
"stripped instanceof Project" never returns true. I suspect that these
days RelBuilder is removing trivial projects before they even hit the
planner. But we still need a planner rule for this.

Can you log a JIRA case for this, please? The fix should make
ProjectRemoveRule into a two argument rule, and also add at least one
test to RelOptRulesTest.

Julian


On Tue, Jan 17, 2017 at 7:31 AM, Jess Balint <jb...@gmail.com> wrote:
> Hi,
> I used ProjectRemoveRule, but it's not working. When debugging, I arrive at
> this code:
>
> Project project = call.rel(0);
> RelNode stripped = project.getInput();
> if (stripped instanceof Project) {
>
> The *stripped* object here is an instance of *HepRelVertex* and therefore
> this code does not recognize the child as a projection and loses the field
> names. How should this be reconciled?
>
> Thanks.
> Jess