Hello Calcite-experts --

I am new to Calcite (and optimzers in general). I am trying to understand how other RelTrait conversions work in Calcite. It looks like Conventions are treated specially and handled at the root, but I am curious to understand how other traits (Distribution/Collation) are handled. I wrote a simple test case to help me understand and to see if I could convert a simple two node tree with convention.NONE to convention.PHYS with some RelDistribution manipulations (TraitConversionTest.java). But the test fails with "could not be implemented". The following transformations were what I envisioned, but it looks like the ConvertRelDistributionTraitDef.convert() is not effective. Could somebody give me pointers as to what should be done to see the following transformations?

TraitConversionTest.java
https://github.com/minji-kim/calcite/commit/d51d93e2bdc3febab0410d1c0f2c61b6cb8af46f

Thanks!
Minji

1) original:
NoneSingleRel
 |
NoneLeafRel

2) desired result:
RandomSingleRel (PHYS.random)
 |
BridgeRel (PHYS.random)
 |
SingletonLeafRel (PHYS.single)


=====
org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node [rel#5:Subset#1.PHYS.any] could not be implemented; planner state:

Root: rel#5:Subset#1.PHYS.any
Original rel:

Sets:
Set#0, type: RecordType(JavaType(void) this)
    rel#2:Subset#0.NONE.any, best=null, importance=0.81
rel#0:NoneLeafRel.NONE.any(label=a), rowcount=1.0, cumulative cost={inf}
    rel#7:Subset#0.PHYS.random, best=null, importance=0.81
    rel#12:Subset#0.PHYS.single, best=rel#11, importance=0.405
rel#11:SingletonLeafRel.PHYS.single(label=a), rowcount=1.0, cumulative cost={tiny}
Set#1, type: RecordType(JavaType(void) this)
    rel#4:Subset#1.NONE.any, best=null, importance=0.9
rel#3:NoneSingleRel.NONE.any(input=rel#2:Subset#0.NONE.any), rowcount=1.0, cumulative cost={inf}
    rel#5:Subset#1.PHYS.any, best=null, importance=1.0
rel#6:AbstractConverter.PHYS.any(input=rel#4:Subset#1.NONE.any,convention=PHYS,dist=any), rowcount=1.0, cumulative cost={inf} rel#10:AbstractConverter.PHYS.any(input=rel#9:Subset#1.PHYS.random,convention=PHYS,dist=any), rowcount=1.0, cumulative cost={inf} rel#8:RandomSingleRel.PHYS.random(input=rel#7:Subset#0.PHYS.random), rowcount=1.0, cumulative cost={inf}
    rel#9:Subset#1.PHYS.random, best=null, importance=0.9
rel#8:RandomSingleRel.PHYS.random(input=rel#7:Subset#0.PHYS.random), rowcount=1.0, cumulative cost={inf}

Reply via email to