Double rowCount = mq.getRowCount(rel); if (call.isA(SqlKind.MINUS_PREFIX)) { distinctRowCount = cardOfProjExpr(mq, rel, call.getOperands().get(0)); } else if (call.isA(ImmutableList.of(SqlKind.PLUS, SqlKind.MINUS))) { Double card0 = cardOfProjExpr(mq, rel, call.getOperands().get(0)); if (card0 == null) { return null; Double card1 = cardOfProjExpr(mq, rel, call.getOperands().get(1)); if (card1 == null) { return null; distinctRowCount = NumberUtil.multiply( cardOfProjExpr(mq, rel, call.getOperands().get(0)), cardOfProjExpr(mq, rel, call.getOperands().get(1))); distinctRowCount = cardOfProjExpr(mq, rel, call.getOperands().get(0)); } else { distinctRowCount = rowCount / 10;
Double rowCount = mq.getRowCount(rel); if (call.isA(SqlKind.MINUS_PREFIX)) { distinctRowCount = cardOfProjExpr(mq, rel, call.getOperands().get(0)); } else if (call.isA(ImmutableList.of(SqlKind.PLUS, SqlKind.MINUS))) { Double card0 = cardOfProjExpr(mq, rel, call.getOperands().get(0)); if (card0 == null) { return null; Double card1 = cardOfProjExpr(mq, rel, call.getOperands().get(1)); if (card1 == null) { return null; distinctRowCount = NumberUtil.multiply( cardOfProjExpr(mq, rel, call.getOperands().get(0)), cardOfProjExpr(mq, rel, call.getOperands().get(1))); distinctRowCount = cardOfProjExpr(mq, rel, call.getOperands().get(0)); } else { distinctRowCount = rowCount / 10;
public Double getPopulationSize(Project rel, RelMetadataQuery mq, ImmutableBitSet groupKey) { ImmutableBitSet.Builder baseCols = ImmutableBitSet.builder(); ImmutableBitSet.Builder projCols = ImmutableBitSet.builder(); List<RexNode> projExprs = rel.getProjects(); RelMdUtil.splitCols(projExprs, groupKey, baseCols, projCols); Double population = mq.getPopulationSize(rel.getInput(), baseCols.build()); if (population == null) { return null; } // No further computation required if the projection expressions are // all column references if (projCols.cardinality() == 0) { return population; } for (int bit : projCols.build()) { Double subRowCount = RelMdUtil.cardOfProjExpr(mq, rel, projExprs.get(bit)); if (subRowCount == null) { return null; } population *= subRowCount; } // REVIEW zfong 6/22/06 - Broadbase did not have the call to // numDistinctVals. This is needed; otherwise, population can be // larger than the number of rows in the RelNode. return RelMdUtil.numDistinctVals(population, mq.getRowCount(rel)); }
public Double getPopulationSize(Project rel, RelMetadataQuery mq, ImmutableBitSet groupKey) { ImmutableBitSet.Builder baseCols = ImmutableBitSet.builder(); ImmutableBitSet.Builder projCols = ImmutableBitSet.builder(); List<RexNode> projExprs = rel.getProjects(); RelMdUtil.splitCols(projExprs, groupKey, baseCols, projCols); Double population = mq.getPopulationSize(rel.getInput(), baseCols.build()); if (population == null) { return null; } // No further computation required if the projection expressions are // all column references if (projCols.cardinality() == 0) { return population; } for (int bit : projCols.build()) { Double subRowCount = RelMdUtil.cardOfProjExpr(mq, rel, projExprs.get(bit)); if (subRowCount == null) { return null; } population *= subRowCount; } // REVIEW zfong 6/22/06 - Broadbase did not have the call to // numDistinctVals. This is needed; otherwise, population can be // larger than the number of rows in the RelNode. return RelMdUtil.numDistinctVals(population, mq.getRowCount(rel)); }
RelMdUtil.cardOfProjExpr(mq, rel, projExprs.get(bit)); if (subRowCount == null) { return null;
RelMdUtil.cardOfProjExpr(mq, rel, projExprs.get(bit)); if (subRowCount == null) { return null;