[ https://issues.apache.org/jira/browse/CALCITE-1862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16398207#comment-16398207 ]
Julian Hyde commented on CALCITE-1862: -------------------------------------- I've seen situations like this before. It's difficult to know whether the rules, the engine (volcano or hep) or the statistics are at fault. My conclusion is that the rules are in the best position to do something. They should be recognizing that they are generating something equivalent, and not generate it. Maybe RelBuilder.simplifier should be smarter. > StackOverflowException in RelMdUtil.estimateFilteredRows > -------------------------------------------------------- > > Key: CALCITE-1862 > URL: https://issues.apache.org/jira/browse/CALCITE-1862 > Project: Calcite > Issue Type: Bug > Reporter: Julian Hyde > Assignee: Julian Hyde > Priority: Major > > The query > {code}select * > from ( > select * > from ( > select cast(null as integer) as d > from "scott".emp) > where d is null and d is null) > where d is null;{code} > gives > {noformat} > java.lang.StackOverflowError > > at > > org.apache.calcite.adapter.clone.ArrayTable.getStatistic(ArrayTable.java:76) > > at > > org.apache.calcite.prepare.RelOptTableImpl.getRowCount(RelOptTableImpl.java:224) > > at > > org.apache.calcite.rel.core.TableScan.estimateRowCount(TableScan.java:75) > > at > > org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:206) > > at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) > > at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) > > at > > org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:236) > > at > > org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:71) > > at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) > > at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) > > at > > org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:236) > > at > > org.apache.calcite.rel.metadata.RelMdUtil.estimateFilteredRows(RelMdUtil.java:718) > > at > > org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:123) > > at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) > > at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) > > at > > org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:236) > > at > > org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:71) > > at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) > > at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) > > at > > org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:236) > > at > > org.apache.calcite.rel.metadata.RelMdUtil.estimateFilteredRows(RelMdUtil.java:718){noformat} > For a test case, add the query to misc.iq and run QuidemTest. -- This message was sent by Atlassian JIRA (v7.6.3#76005)