zzwqqq created CALCITE-7895:
-------------------------------
Summary: Interpreter fails to execute plans containing
EnumerableBindable inputs
Key: CALCITE-7895
URL: https://issues.apache.org/jira/browse/CALCITE-7895
Project: Calcite
Issue Type: Bug
Components: core
Reporter: zzwqqq
Assignee: zzwqqq
Interpreter throws a NullPointerException in CompilerImpl.visit() when
executing this plan, instead of returning the query results:
{noformat}
BindableSort
EnumerableBindable
EnumerableCalc
EnumerableTableScan
{noformat}
To reproduce, run this test in InterpreterTest.
{code:java}
@Test void testInterpretEnumerableSql() {
CalciteAssert.hr()
.query("select \"empid\" + 1 as x from \"hr\".\"emps\" order by x")
.withProperty(Hook.ENABLE_BINDABLE, true)
.withHook(Hook.PLANNER, (RelOptPlanner planner) -> {
planner.removeRule(Bindables.FROM_NONE_RULE);
planner.removeRule(Bindables.BINDABLE_PROJECT_RULE);
planner.removeRule(EnumerableRules.ENUMERABLE_SORT_RULE);
planner.removeRule(EnumerableRules.TO_INTERPRETER);
})
.explainContains("BindableSort(sort0=[$0], dir0=[ASC])\n"
+ " EnumerableBindable\n"
+ " EnumerableCalc(")
.returns("X=101\nX=111\nX=151\nX=201\n");
}
{code}
A possible fix is to keep EnumerableBindable and EnumerableInterpretable inputs
out of interpreter rewrites and compilation, and let the converters register
their output through Compiler.enumerable() using the query's DataContext.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)