calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Masayuki Takahashi <masayuki...@gmail.com>
Subject Re: Volcano Planner - Tree unimplementable
Date Sat, 17 Mar 2018 16:18:57 GMT
Hi, Abbas.

I think that this error cause by "rel#7:Subset#1.ENUMERABLE.[],
best=null, importance=0.5".
This rel was selected at Set#1 because this one is ENUMERABLE and "best=null".

I think that you should convert ENUMERABLE to NativeTeradataConvention
because enumerable convention is default.

https://github.com/apache/calcite/blob/9c6dc773e31a8b555350a75a6e9d9199b8244219/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java#L181

To convert ENUMERABLE to NativeTeradataConvention, you should create
ConverterRule and Converter.
In case of Cassandra it is as follows:

https://github.com/apache/calcite/blob/9c6dc773e31a8b555350a75a6e9d9199b8244219/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverterRule.java
https://github.com/apache/calcite/blob/9c6dc773e31a8b555350a75a6e9d9199b8244219/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverter.java

And register the ConverterRule.

https://github.com/apache/calcite/blob/9c6dc773e31a8b555350a75a6e9d9199b8244219/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTableScan.java#L66

thanks.


2018-03-13 18:23 GMT+09:00 Abbas Gadhia <ab_gadhia@yahoo.com.invalid>:
> Hi,
>
> I'm having problems getting the Volcano Planner to implement my Rel tree. I keep getting
errors like "could not be implemented; planner state"
>
> My target tree has 2 conventions. The first is what i'm calling a "Native" convention
which is similar to the JdbcConvention in its semantics, but I dont use the JdbcConvention
because it forces me to create JdbcTableScans that need an instance of a live jdbc Datasource.
The second convention I have is called Foo (for lack of a better name), using which I intend
to physically implement or execute my Rel tree.
>
> Here is my original rel, which i built using a 2 Relbuilders (1 Relbuilder built using
a custom TableScanFactory and the other Relbuilder built using an empty Context i.e default
TableScanFactory)
>
> LogicalProject
> --NativeTableScan
>
>
> To implement this tree, I have a few rules set up such as,
>
> NativeToFooConverterRule (similar to JdbcToEnumerableConverterRule)
> NativeProjectRule (similar to JdbcProjectRule)
>
>
> I register these rules inside of the NativeConvention in the register method (similar
to JdbcConvention). For now, i've hardcoded the cost (row count) of the NativeTable object
(which reside inside RelOptSchema) to be 100. The planner state, after it fails is below.
In case the full log with TRACE levels is needed, i've attached it here. https://tinyurl.com/yct3hnle
>
> java.lang.RuntimeException: org.apache.calcite.plan.RelOptPlanner$CannotPlanException:
Node [rel#4:Subset#1.NONE.[]] could not be implemented; planner state:
>
> Root: rel#4:Subset#1.NONE.[]
>
> Original rel:
> LogicalProject(subset=[rel#4:Subset#1.NONE.[]], id=[$0]): rowcount = 100.0, cumulative
cost = {100.0 rows, 100.0 cpu, 0.0 io}, id = 3
>   NativeTableScan(subset=[rel#2:Subset#0.NativeTeradataConvention.[]], table=[[s1, emp]]):
rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 0
>
> Sets:
> Set#0, type: RecordType(INTEGER id, VARCHAR name, INTEGER department)
>         rel#2:Subset#0.NativeTeradataConvention.[], best=rel#0, importance=0.9
>         rel#0:NativeTableScan.NativeTeradataConvention.[](table=[s1, emp]), rowcount=100.0,
cumulative cost={100.0 rows, 101.0 cpu, 0.0 io}
>     rel#5:Subset#0.ENUMERABLE.[], best=null, importance=0.45
>     rel#15:Subset#0.BeamConvention.[], best=rel#14, importance=0.45
>         rel#14:NativeToBeamConverterRel.BeamConvention.[](input=rel#2:Subset#0.NativeTeradataConvention.[]),
rowcount=100.0, cumulative cost={110.0 rows, 111.0 cpu, 0.0 io}
> Set#1, type: RecordType(INTEGER id)
>         rel#4:Subset#1.NONE.[], best=null, importance=1.0
>         rel#3:LogicalProject.NONE.[](input=rel#2:Subset#0.NativeTeradataConvention.[],id=$0),
rowcount=100.0, cumulative cost={inf}
>     rel#7:Subset#1.ENUMERABLE.[], best=null, importance=0.5
>         rel#6:EnumerableProject.ENUMERABLE.[](input=rel#5:Subset#0.ENUMERABLE.[],id=$0),
rowcount=100.0, cumulative cost={inf}
>     rel#9:Subset#1.NativeTeradataConvention.[], best=rel#8, importance=0.5
>         rel#8:NativeProject.NativeTeradataConvention.[](input=rel#2:Subset#0.NativeTeradataConvention.[],id=$0),
rowcount=100.0, cumulative cost={180.0 rows, 181.0 cpu, 0.0 io}
> rel#11:Subset#1.BeamConvention.[], best=rel#10, importance=0.5
>     rel#10:NativeToBeamConverterRel.BeamConvention.[](input=rel#9:Subset#1.NativeTeradataConvention.[]),
rowcount=100.0, cumulative cost={190.0 rows, 191.0 cpu, 0.0 io}
>
> I tried referring to this email on the mailing list, but so far no luck.
> https://mail-archives.apache.org/mod_mbox/calcite-dev/201606.mbox/%3cCFA8C0E7E88FC641B42FB1B7E70FC487B8BC8FE9@szxema508-mbx.china.huawei.com%3e
>
> Thanks
> Abbas



-- 
高橋 真之

Mime
View raw message