[
https://issues.apache.org/jira/browse/CALCITE-3055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16835748#comment-16835748
]
Bohdan Kazydub commented on CALCITE-3055:
-----------------------------------------
Here is the change:
[commit|https://github.com/KazydubB/calcite/commit/179aef66b4b50f4097a48d56613ecbf6d1bd10d8].
With this solution there are 989 test failures, because additional item was
added to *TableScan, e.g.
{code}
[ERROR] PlannerTest.testSortPlan:540
Expected: "EnumerableSort(sort0=[$1], dir0=[ASC])\n
EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3],
commission=[$4])\n EnumerableTableScan(table=[[hr, emps]])\n"
but: was "EnumerableSort(sort0=[$1], dir0=[ASC])\n
EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3],
commission=[$4])\n EnumerableTableScan(table=[[hr, emps]],
rowType=[RecordType(JavaType(int) empid, JavaType(int) deptno, JavaType(class
java.lang.String) name, JavaType(float) salary, JavaType(class
java.lang.Integer) commission)])\n"
[ERROR] PlannerTest.testTwoSortRemoveInnerSort:616->runDuplicateSortCheck:680
Expected: "EnumerableSort(sort0=[$1], dir0=[ASC])\n
EnumerableProject(EXPR$0=[+($0, $1)], deptno=[$1])\n
EnumerableTableScan(table=[[hr, emps]])\n"
but: was "EnumerableSort(sort0=[$1], dir0=[ASC])\n
EnumerableProject(EXPR$0=[+($0, $1)], deptno=[$1])\n
EnumerableTableScan(table=[[hr, emps]], rowType=[RecordType(JavaType(int)
empid, JavaType(int) deptno, JavaType(class java.lang.String) name,
JavaType(float) salary, JavaType(class java.lang.Integer) commission)])\n"
{code}
If there are no objections with the change I will proceed with fixing test
failures caused by the change.
> TableScan type mismatch in VolcanoPlanner
> -----------------------------------------
>
> Key: CALCITE-3055
> URL: https://issues.apache.org/jira/browse/CALCITE-3055
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.19.0
> Reporter: Bohdan Kazydub
> Priority: Major
>
> In Drill with Calcite updated to 1.19.0 we observe following problem:
> the following query
> {code}
> CREATE VIEW nation_view_testunionall_expandable_star AS select n_name,
> n_nationkey FROM cp.`tpch/nation.parquet`;
> (SELECT n_comment, n_regionkey FROM cp.`tpch/nation.parquet` LIMIT 5) UNION
> ALL (SELECT * FROM nation_view_testunionall_expandable_star LIMIT 5)
> {code}
> fails with
> {code}
> 15:46:06.005 [2333c7f1-89f3-0b80-8369-68e24895729e:foreman] ERROR
> o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: AssertionError: Type
> mismatch:
> left:
> RecordType(DYNAMIC_STAR **, ANY n_comment, ANY n_regionkey) NOT NULL
> right:
> RecordType(DYNAMIC_STAR **, ANY n_comment, ANY n_regionkey, ANY n_name, ANY
> n_nationkey) NOT NULL
> {code}
> when Volcano planner is registering rel nodes. The initial plan is the
> following:
> {code}
> LogicalUnion(all=[true]): rowcount = 10.0, cumulative cost = \{520.0 rows,
> 940.755032994728 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 74
> LogicalSort(fetch=[5]): rowcount = 5.0, cumulative cost = \{205.0 rows,
> 365.377516497364 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 68
> LogicalProject(n_comment=[$1], n_regionkey=[$2]): rowcount = 100.0,
> cumulative cost = \{200.0 rows, 301.0 cpu, 0.0 io, 0.0 network, 0.0 memory},
> id = 67
> EnumerableTableScan(table=[[cp, tpch/nation.parquet]]): rowcount =
> 100.0, cumulative cost = \{100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0
> memory}, id = 29
> LogicalSort(fetch=[5]): rowcount = 5.0, cumulative cost = \{305.0 rows,
> 565.377516497364 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 73
> LogicalProject(n_name=[$0], n_nationkey=[$1]): rowcount = 100.0,
> cumulative cost = \{300.0 rows, 501.0 cpu, 0.0 io, 0.0 network, 0.0 memory},
> id = 72
> LogicalProject(n_name=[$3], n_nationkey=[$4]): rowcount = 100.0,
> cumulative cost = \{200.0 rows, 301.0 cpu, 0.0 io, 0.0 network, 0.0 memory},
> id = 71
> EnumerableTableScan(table=[[cp, tpch/nation.parquet]]): rowcount =
> 100.0, cumulative cost = \{100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0
> memory}, id = 34
> {code}
> It contains two EnumerableTableScan operators with different row types
> specified in the error message above. In the scope of CALCITE-2454 was
> removed rel data type from the key in the \{{VolcanoPlanner.mapDigestToRel}}
> map.
> To fix this, `{{TableScan` should include rowType}} item in
> {{AbstractRelNode#explainTerms(RelWriter)}} method because in case of dynamic
> tables there is the same digest for different operators. The same thing was
> done for Values operator and literals in conditions.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)