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

NullPointerException in getMaxRowCount for Aggregate

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.6.0
    • Component/s: core
    • Labels:
      None

      Description

      After commit 24b0747 for CALCITE-987, I get an error from a test in my own project, but the test is all copied from calcite.

      The query is this:

      with
      t1(x) as (select * from  (values 1,2, case when 1 = 1 then null else 3 end)),
      t2(x) as (select * from  (values 1,case when 1 = 1 then null else 3 end))
      select *
      from t1
      where t1.x not in (select t2.x from t2);
      

      I took that from core/src/test/resources/sql/subquery.oq, and I'm running with the CsvSchemaFactory and TRANSLATABLE.

      Abbreviated stacktrace (most of it is reflection noise):

      	...
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:86)
      	at org.apache.calcite.plan.hep.HepPlanner.dumpGraph(HepPlanner.java:958)
      	at org.apache.calcite.plan.hep.HepPlanner.applyTransformationResults(HepPlanner.java:723)
      	at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:518)
      	at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:392)
      	at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:255)
      	at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:125)
      	at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:207)
      	at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:194)
      	... more
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:86)
      	at org.apache.calcite.rel.core.Filter.estimateFilteredRows(Filter.java:156)
      	at org.apache.calcite.rel.core.Filter.estimateFilteredRows(Filter.java:150)
      	at org.apache.calcite.rel.core.Calc.getRows(Calc.java:135)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:144)
      	... 50 more
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getMaxRowCount(RelMetadataQuery.java:101)
      	at org.apache.calcite.rel.metadata.RelMdUtil.getJoinRowCount(RelMdUtil.java:705)
      	at org.apache.calcite.rel.core.Join.getRows(Join.java:175)
      	at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:144)
      	... 90 more
      	at org.apache.calcite.rel.metadata.RelMetadataQuery.getMaxRowCount(RelMetadataQuery.java:101)
      	at org.apache.calcite.rel.metadata.RelMdMaxRowCount.getMaxRowCount(RelMdMaxRowCount.java:108)
      	... 105 more
      Caused by: java.lang.NullPointerException
      	at org.apache.calcite.rel.metadata.RelMdMaxRowCount.getMaxRowCount(RelMdMaxRowCount.java:102)
      	... 125 more
      

        Activity

        Hide
        mikehinchey Mike Hinchey added a comment -

        I have a fix, though I couldn't reproduce within a calcite test:
        https://github.com/apache/calcite/pull/173

        Show
        mikehinchey Mike Hinchey added a comment - I have a fix, though I couldn't reproduce within a calcite test: https://github.com/apache/calcite/pull/173
        Hide
        julianhyde Julian Hyde added a comment -

        We're OK without a test case for this one. Your change is clearly an improvement. Will commit after tests pass.

        Show
        julianhyde Julian Hyde added a comment - We're OK without a test case for this one. Your change is clearly an improvement. Will commit after tests pass.
        Hide
        julianhyde Julian Hyde added a comment -
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/b0fa9f37 . Thanks for the PR, Mike Hinchey !
        Hide
        julianhyde Julian Hyde added a comment -

        Resolved in release 1.6.0 (2016-01-22).

        Show
        julianhyde Julian Hyde added a comment - Resolved in release 1.6.0 (2016-01-22).

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            mikehinchey Mike Hinchey
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development