You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Vladimir Ozerov <pp...@gmail.com> on 2021/06/06 13:09:16 UTC

Possibly incorrect assertion in the TopDownRuleDriver.DeriveTrait.derive

Hi,

When doing a trait derivation in the non-OMAKASE mode, the following lines
of code are invoked:
1: RelSubset relSubset = planner.register(newRel, rel);
2: assert relSubset.set == planner.getSubset(rel).set;

The assertion on the second line may fail because the "newRel" is assigned
not the "rel" set, but "rel" *canonical set*, which might be different.

As a workaround, we may change the derive mode to OMAKASE. In this case, we
do not hit the assertion and planning completes successfully.

Shouldn't we remove the assertion above?

Regards,
Vladimir.

Re: Possibly incorrect assertion in the TopDownRuleDriver.DeriveTrait.derive

Posted by Haisheng Yuan <hy...@apache.org>.
I don't think the the assertion is wrong, it is expected. Equivalent relational operators should be in the same set. I think CALCITE-3981[1] fixed the canonical issue, I suspect the rel2subset mapping is not up to date, hence the assertion error. 

[1] https://issues.apache.org/jira/browse/CALCITE-3981

On 2021/06/13 18:35:02, Vladimir Ozerov <pp...@gmail.com> wrote: 
> Thanks, I created an issue [1] to improve the assertion.
> 
> [1] https://issues.apache.org/jira/browse/CALCITE-4650
> 
> пн, 7 июн. 2021 г. в 23:30, Haisheng Yuan <hy...@apache.org>:
> 
> > > Shouldn't we remove the assertion above?
> > Perhaps.
> >
> > Or perhaps the rel2Subset mapping is not up to date.
> >
> > Regards,
> > Haisheng Yuan
> >
> > On 2021/06/06 13:09:16, Vladimir Ozerov <pp...@gmail.com> wrote:
> > > Hi,
> > >
> > > When doing a trait derivation in the non-OMAKASE mode, the following
> > lines
> > > of code are invoked:
> > > 1: RelSubset relSubset = planner.register(newRel, rel);
> > > 2: assert relSubset.set == planner.getSubset(rel).set;
> > >
> > > The assertion on the second line may fail because the "newRel" is
> > assigned
> > > not the "rel" set, but "rel" *canonical set*, which might be different.
> > >
> > > As a workaround, we may change the derive mode to OMAKASE. In this case,
> > we
> > > do not hit the assertion and planning completes successfully.
> > >
> > > Shouldn't we remove the assertion above?
> > >
> > > Regards,
> > > Vladimir.
> > >
> >
> 

Re: Possibly incorrect assertion in the TopDownRuleDriver.DeriveTrait.derive

Posted by Vladimir Ozerov <pp...@gmail.com>.
Thanks, I created an issue [1] to improve the assertion.

[1] https://issues.apache.org/jira/browse/CALCITE-4650

пн, 7 июн. 2021 г. в 23:30, Haisheng Yuan <hy...@apache.org>:

> > Shouldn't we remove the assertion above?
> Perhaps.
>
> Or perhaps the rel2Subset mapping is not up to date.
>
> Regards,
> Haisheng Yuan
>
> On 2021/06/06 13:09:16, Vladimir Ozerov <pp...@gmail.com> wrote:
> > Hi,
> >
> > When doing a trait derivation in the non-OMAKASE mode, the following
> lines
> > of code are invoked:
> > 1: RelSubset relSubset = planner.register(newRel, rel);
> > 2: assert relSubset.set == planner.getSubset(rel).set;
> >
> > The assertion on the second line may fail because the "newRel" is
> assigned
> > not the "rel" set, but "rel" *canonical set*, which might be different.
> >
> > As a workaround, we may change the derive mode to OMAKASE. In this case,
> we
> > do not hit the assertion and planning completes successfully.
> >
> > Shouldn't we remove the assertion above?
> >
> > Regards,
> > Vladimir.
> >
>

Re: Possibly incorrect assertion in the TopDownRuleDriver.DeriveTrait.derive

Posted by Haisheng Yuan <hy...@apache.org>.
> Shouldn't we remove the assertion above?
Perhaps.

Or perhaps the rel2Subset mapping is not up to date.

Regards,
Haisheng Yuan

On 2021/06/06 13:09:16, Vladimir Ozerov <pp...@gmail.com> wrote: 
> Hi,
> 
> When doing a trait derivation in the non-OMAKASE mode, the following lines
> of code are invoked:
> 1: RelSubset relSubset = planner.register(newRel, rel);
> 2: assert relSubset.set == planner.getSubset(rel).set;
> 
> The assertion on the second line may fail because the "newRel" is assigned
> not the "rel" set, but "rel" *canonical set*, which might be different.
> 
> As a workaround, we may change the derive mode to OMAKASE. In this case, we
> do not hit the assertion and planning completes successfully.
> 
> Shouldn't we remove the assertion above?
> 
> Regards,
> Vladimir.
>