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

Jinfeng Ni commented on CALCITE-628:
------------------------------------

The RelOptRule.convert() change in  
https://github.com/julianhyde/incubator-calcite/commit/74daae79ba4ff56a10f485cdfc9d99fc55324b71
 makes sense to me. Actually, that's the change we made, when Drill tries to 
rebase on the Calcite recent master branch (release 1.1). Otherwise, it would 
regress almost every query.

The reason that simplify() is a must for Drill, or 
TestTraitPropagation.withoutHack is that Calcite uses EmptyCompositeTrait to 
represent empty collation when create EnumerableTable/LogicalProject etc.   
That means we have to call simplify(), if we pass this empty collation 
represented as EmptyCompositeTrait as the target trait.

I'm not so sure the new simplify() logic, where the code uses default trait, if 
it has more than 1 trait. But I also do not know any better idea. So, overall 
looks fine to me.




> Calcite hit Assertion Error when calling Frameworks.planner or 
> RelOptRule.convert(), if the target trait is composite  
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-628
>                 URL: https://issues.apache.org/jira/browse/CALCITE-628
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Jinfeng Ni
>            Assignee: Julian Hyde
>
> CALCITE-88 introduces the concept of RelCompositeTrait. As such, Calcite 
> seems to require that each new RelSubSet should only have simple trait, in 
> stead of composite traits. If that condition is not meet, an assertion will 
> be thrown.
> However, when we use Frameworks.planner to call transform(),  or use 
> RelOptRule to call convert() method, there is no guarantee that the target 
> traits are simple.  If the target traits happened to be composite, then 
> Calcite will hit Assertion at RelSubset.java:108.
> There seems to be two options to fix this Assertion and ensure RelSubset only 
> have simple traitsets :
> 1) Follow the way Prepare.optimize(), and call simplify() for the target 
> traitset, in both PlannerImpl.transform() or RelOptRule.convert().
> 2) Each callers of transform(), or convert() method should make sure the 
> target traits are simple.
> The patch I'm going to submit uses the 1st option, using the same logic in 
> Prepare.optimize().
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to