[ https://issues.apache.org/jira/browse/CALCITE-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16371562#comment-16371562 ]
zhen wang commented on CALCITE-2068: ------------------------------------ is this purely from code review perspective or there is a real test case you need to solve ? [~godfreyhe] > throws NPE in RelMdPercentageOriginalRows when getPercentageOriginalRows > returns null > ------------------------------------------------------------------------------------- > > Key: CALCITE-2068 > URL: https://issues.apache.org/jira/browse/CALCITE-2068 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.13.0 > Reporter: godfrey he > Assignee: Julian Hyde > Priority: Major > > these two methods will get NEP when mq.getPercentageOriginalRows return null: > {code:title=RelMdPercentageOriginalRows.java|borderStyle=solid} > public Double getPercentageOriginalRows(Union rel, RelMetadataQuery mq) { > double numerator = 0.0; > double denominator = 0.0; > for (RelNode input : rel.getInputs()) { > double rowCount = mq.getRowCount(input); > double percentage = mq.getPercentageOriginalRows(input); > if (percentage != 0.0) { > denominator += rowCount / percentage; > numerator += rowCount; > } > } > return quotientForPercentage(numerator, denominator); > } > public Double getPercentageOriginalRows(Join rel, RelMetadataQuery mq) { > double left = mq.getPercentageOriginalRows(rel.getLeft()); > double right = mq.getPercentageOriginalRows(rel.getRight()); > return left * right; > } > {code} > assigning null to double (NOT Double type) will get NPE. -- This message was sent by Atlassian JIRA (v7.6.3#76005)