Tabnine Logo
org.apache.calcite.rel.metadata
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.calcite.rel.metadata

Best Java code snippets using org.apache.calcite.rel.metadata (Showing top 20 results out of 315)

origin: apache/hive

public RelMetadataProvider getMetadataProvider() {
 return ReflectiveRelMetadataProvider.reflectiveSource(this,
       BuiltInMethod.IS_PHASE_TRANSITION.method,
       BuiltInMethod.SPLIT_COUNT.method);
}
origin: apache/hive

protected FilterSelectivityEstimator(RelNode childRel, RelMetadataQuery mq) {
 super(true);
 this.mq = mq;
 this.childRel = childRel;
 this.childCardinality = mq.getRowCount(childRel);
}
origin: apache/hive

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);
}
origin: apache/hive

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();
}

origin: apache/drill

protected FilterSelectivityEstimator(RelNode childRel) {
 super(true);
 this.childRel = childRel;
 this.childCardinality = RelMetadataQuery.instance().getRowCount(childRel);
}
origin: apache/hive

public RelMetadataProvider getMetadataProvider() {
 return ChainedRelMetadataProvider.of(
       ImmutableList.of(
         ReflectiveRelMetadataProvider.reflectiveSource(this,
           BuiltInMethod.NON_CUMULATIVE_COST.method),
         RelMdPercentageOriginalRows.SOURCE));
}
origin: apache/drill

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;
}
origin: apache/drill

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;
}
origin: apache/kylin

  public RelDistribution get() {
    return RelMdDistribution.values(rowType, tuples);
  }
});
origin: apache/hive

@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);
}
origin: apache/kylin

  public List<RelCollation> get() {
    return RelMdCollation.values(mq, rowType, tuples);
  }
}).replaceIf(RelDistributionTraitDef.INSTANCE, new Supplier<RelDistribution>() {
origin: apache/drill

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();
}

origin: apache/drill

public RelMetadataProvider getMetadataProvider() {
 return ChainedRelMetadataProvider.of(
       ImmutableList.of(
         ReflectiveRelMetadataProvider.reflectiveSource(this,
           BuiltInMethod.NON_CUMULATIVE_COST.method),
         RelMdPercentageOriginalRows.SOURCE));
}
origin: apache/hive

public static RelOptCost computeCardinalityBasedCost(HiveRelNode hr, RelMetadataQuery mq) {
 return new HiveCost(mq.getRowCount(hr), 0, 0);
}
origin: apache/drill

public RelMetadataProvider getMetadataProvider() {
 return ReflectiveRelMetadataProvider.reflectiveSource(this,
       BuiltInMethod.IS_PHASE_TRANSITION.method,
       BuiltInMethod.SPLIT_COUNT.method);
}
origin: apache/hive

@Override
public RelOptCost getScanCost(HiveTableScan ts, RelMetadataQuery mq) {
 return algoUtils.computeScanCost(mq.getRowCount(ts), mq.getAverageRowSize(ts));
}
origin: apache/incubator-druid

 @Override
 public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq)
 {
  return planner.getCostFactory().makeCost(mq.getRowCount(sourceRel), 0, 0).multiplyBy(10);
 }
}
origin: apache/hive

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;
}
origin: apache/drill

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;
}
origin: apache/hive

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;
}
org.apache.calcite.rel.metadata

Most used classes

  • RelMetadataQuery
    RelMetadataQuery provides a strongly-typed facade on top of RelMetadataProvider for the set of relat
  • RelMdUtil
    RelMdUtil provides utility methods used by the metadata provider methods.
  • ChainedRelMetadataProvider
    Implementation of the RelMetadataProviderinterface via the org.apache.calcite.util.Glossary#CHAIN_OF
  • RelColumnOrigin
    RelColumnOrigin is a data structure describing one of the origins of an output column produced by a
  • CachingRelMetadataProvider
    Implementation of the RelMetadataProviderinterface that caches results from an underlying provider.
  • RelMetadataProvider,
  • NullSentinel,
  • ReflectiveRelMetadataProvider,
  • RelMdCollation,
  • RelMdDistinctRowCount,
  • RelMdRowCount,
  • RelMdColumnUniqueness,
  • Metadata,
  • RelMdDistribution,
  • UnboundMetadata,
  • BuiltInMetadata$AllPredicates$Handler,
  • BuiltInMetadata$Collation$Handler,
  • BuiltInMetadata$ColumnOrigin$Handler,
  • BuiltInMetadata$ColumnUniqueness$Handler
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now