/** * Computes the population size for a set of keys returned from a join * * @param joinRel the join rel * @param groupKey keys to compute the population for * @return computed population size */ public static Double getJoinPopulationSize(RelMetadataQuery mq, RelNode joinRel, ImmutableBitSet groupKey) { ImmutableBitSet.Builder leftMask = ImmutableBitSet.builder(); ImmutableBitSet.Builder rightMask = ImmutableBitSet.builder(); RelNode left = joinRel.getInputs().get(0); RelNode right = joinRel.getInputs().get(1); // separate the mask into masks for the left and right RelMdUtil.setLeftRightBitmaps( groupKey, leftMask, rightMask, left.getRowType().getFieldCount()); Double population = NumberUtil.multiply( mq.getPopulationSize(left, leftMask.build()), mq.getPopulationSize(right, rightMask.build())); return numDistinctVals(population, mq.getRowCount(joinRel)); }
/** * Computes the population size for a set of keys returned from a join * * @param joinRel the join rel * @param groupKey keys to compute the population for * @return computed population size */ public static Double getJoinPopulationSize(RelMetadataQuery mq, RelNode joinRel, ImmutableBitSet groupKey) { ImmutableBitSet.Builder leftMask = ImmutableBitSet.builder(); ImmutableBitSet.Builder rightMask = ImmutableBitSet.builder(); RelNode left = joinRel.getInputs().get(0); RelNode right = joinRel.getInputs().get(1); // separate the mask into masks for the left and right RelMdUtil.setLeftRightBitmaps( groupKey, leftMask, rightMask, left.getRowType().getFieldCount()); Double population = NumberUtil.multiply( mq.getPopulationSize(left, leftMask.build()), mq.getPopulationSize(right, rightMask.build())); return numDistinctVals(population, mq.getRowCount(joinRel)); }
RelNode right = joinRel.getInputs().get(1); RelMdUtil.setLeftRightBitmaps( groupKey, leftMask,
RelNode right = joinRel.getInputs().get(1); RelMdUtil.setLeftRightBitmaps( groupKey, leftMask,