Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3971

Support Calc in RelMdColumnOrigins

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.23.0
    • 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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            xzh_dz xzh_dz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h