[
https://issues.apache.org/jira/browse/CALCITE-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Haisheng Yuan resolved CALCITE-3971.
------------------------------------
Fix Version/s: 1.23.0
Resolution: Fixed
Fixed inĀ
[https://github.com/apache/calcite/commit/d1aae57fad71bf10942d4c53b339363537927c29].
> Support Calc in RelMdColumnOrigins
> ----------------------------------
>
> Key: CALCITE-3971
> URL: https://issues.apache.org/jira/browse/CALCITE-3971
> Project: Calcite
> Issue Type: Wish
> Reporter: xzh_dz
> Priority: Major
> Fix For: 1.23.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> 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.
> {code:java}
> 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));
> {code}
> 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)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)