Details
-
Wish
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
In my project, we often use `RelColumnOrigin` to find metadata information for columns.
When i try to get origin column , and i got exception as below, the exception can be reproduced.
final String sql = "select name,deptno from dept"; final RelNode relNode = convertSql(sql); final HepProgram program = new HepProgramBuilder(). addRuleInstance(ProjectToCalcRule.INSTANCE).build(); final HepPlanner planner = new HepPlanner(program); planner.setRoot(relNode); final RelNode calc = planner.findBestExp(); final RelMetadataQuery mq = calc.getCluster().getMetadataQuery(); final RelColumnOrigin nameColumn = mq.getColumnOrigin(calc, 0); assertThat(nameColumn.getOriginColumnOrdinal(), is(1));
java.lang.NullPointerException
at org.apache.calcite.test.RelMetadataTest.testCalcColumnOriginsTable(RelMetadataTest.java:391)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)