public RelMetadataProvider getMetadataProvider() { return ReflectiveRelMetadataProvider.reflectiveSource(this, BuiltInMethod.IS_PHASE_TRANSITION.method, BuiltInMethod.SPLIT_COUNT.method); }
protected FilterSelectivityEstimator(RelNode childRel, RelMetadataQuery mq) { super(true); this.mq = mq; this.childRel = childRel; this.childCardinality = mq.getRowCount(childRel); }
private boolean isSimple(ImmutableBitSet condBits, Filter filter, RelMetadataQuery mq) { // Returns whether the filter is only applied on the key columns if (constraintsBased) { return mq.areColumnsUnique(filter, condBits); } return isKey(condBits, filter, mq); }
public Integer splitCountRepartition(RelNode rel, RelMetadataQuery mq) { // We repartition: new number of splits final Double averageRowSize = mq.getAverageRowSize(rel); final Double rowCount = mq.getRowCount(rel); if (averageRowSize == null || rowCount == null) { return null; } final Double totalSize = averageRowSize * rowCount; final Double splitCount = totalSize / maxSplitSize; return splitCount.intValue(); }
protected FilterSelectivityEstimator(RelNode childRel) { super(true); this.childRel = childRel; this.childCardinality = RelMetadataQuery.instance().getRowCount(childRel); }
public RelMetadataProvider getMetadataProvider() { return ChainedRelMetadataProvider.of( ImmutableList.of( ReflectiveRelMetadataProvider.reflectiveSource(this, BuiltInMethod.NON_CUMULATIVE_COST.method), RelMdPercentageOriginalRows.SOURCE)); }
public static boolean isFittingIntoMemory(Double maxSize, RelNode input, int buckets) { Double currentMemory = RelMetadataQuery.instance().cumulativeMemoryWithinPhase(input); if (currentMemory != null) { if(currentMemory / buckets > maxSize) { return false; } return true; } return false; }
public MapJoinStreamingRelation getStreamingSide() { RelMetadataQuery mq = RelMetadataQuery.instance(); Double leftInputSize = mq.memory(left); Double rightInputSize = mq.memory(right); if (leftInputSize == null && rightInputSize == null) { return MapJoinStreamingRelation.NONE; } else if (leftInputSize != null && (rightInputSize == null || (leftInputSize < rightInputSize))) { return MapJoinStreamingRelation.RIGHT_RELATION; } else if (rightInputSize != null && (leftInputSize == null || (rightInputSize <= leftInputSize))) { return MapJoinStreamingRelation.LEFT_RELATION; } return MapJoinStreamingRelation.NONE; }
public RelDistribution get() { return RelMdDistribution.values(rowType, tuples); } });
@Override public Double getDistinctRowCount(RelNode rel, RelMetadataQuery mq, ImmutableBitSet groupKey, RexNode predicate) { if (rel instanceof HiveTableScan) { return getDistinctRowCount((HiveTableScan) rel, mq, groupKey, predicate); } /* * For now use Calcite' default formulas for propagating NDVs up the Query * Tree. */ return super.getDistinctRowCount(rel, mq, groupKey, predicate); }
public List<RelCollation> get() { return RelMdCollation.values(mq, rowType, tuples); } }).replaceIf(RelDistributionTraitDef.INSTANCE, new Supplier<RelDistribution>() {
public Integer splitCountRepartition(RelNode rel, RelMetadataQuery mq) { // We repartition: new number of splits final Double averageRowSize = mq.getAverageRowSize(rel); final Double rowCount = mq.getRowCount(rel); if (averageRowSize == null || rowCount == null) { return null; } final Double totalSize = averageRowSize * rowCount; final Double splitCount = totalSize / maxSplitSize; return splitCount.intValue(); }
public RelMetadataProvider getMetadataProvider() { return ChainedRelMetadataProvider.of( ImmutableList.of( ReflectiveRelMetadataProvider.reflectiveSource(this, BuiltInMethod.NON_CUMULATIVE_COST.method), RelMdPercentageOriginalRows.SOURCE)); }
public static RelOptCost computeCardinalityBasedCost(HiveRelNode hr, RelMetadataQuery mq) { return new HiveCost(mq.getRowCount(hr), 0, 0); }
public RelMetadataProvider getMetadataProvider() { return ReflectiveRelMetadataProvider.reflectiveSource(this, BuiltInMethod.IS_PHASE_TRANSITION.method, BuiltInMethod.SPLIT_COUNT.method); }
@Override public RelOptCost getScanCost(HiveTableScan ts, RelMetadataQuery mq) { return algoUtils.computeScanCost(mq.getRowCount(ts), mq.getAverageRowSize(ts)); }
@Override public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) { return planner.getCostFactory().makeCost(mq.getRowCount(sourceRel), 0, 0).multiplyBy(10); } }
public Double memory(HiveAggregate aggregate, RelMetadataQuery mq) { final Double avgRowSize = mq.getAverageRowSize(aggregate.getInput()); final Double rowCount = mq.getRowCount(aggregate.getInput()); if (avgRowSize == null || rowCount == null) { return null; } return avgRowSize * rowCount; }
public Double memory(HiveAggregate aggregate, RelMetadataQuery mq) { final Double avgRowSize = mq.getAverageRowSize(aggregate.getInput()); final Double rowCount = mq.getRowCount(aggregate.getInput()); if (avgRowSize == null || rowCount == null) { return null; } return avgRowSize * rowCount; }
public Double memory(HiveSortLimit sort, RelMetadataQuery mq) { if (sort.getCollation() != RelCollations.EMPTY) { // It sorts final Double avgRowSize = mq.getAverageRowSize(sort.getInput()); final Double rowCount = mq.getRowCount(sort.getInput()); if (avgRowSize == null || rowCount == null) { return null; } return avgRowSize * rowCount; } // It does not sort, memory footprint is zero return 0.0; }