Tabnine Logo
RelMetadataQuery.getCumulativeCost
Code IndexAdd Tabnine to your IDE (free)

How to use
getCumulativeCost
method
in
org.apache.calcite.rel.metadata.RelMetadataQuery

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

origin: apache/hive

 public RelOptCost getCumulativeCost(HiveJoin rel, RelMetadataQuery mq) {
  RelOptCost cost = mq.getNonCumulativeCost(rel);
  List<RelNode> inputs = rel.getInputs();
  RelOptCost maxICost = HiveCost.ZERO;
  for (RelNode input : inputs) {
   RelOptCost iCost = mq.getCumulativeCost(input);
   if (maxICost.isLt(iCost)) {
    maxICost = iCost;
   }
  }
  return cost.plus(maxICost);
 }
}
origin: apache/drill

 public RelOptCost getCumulativeCost(HiveJoin rel, RelMetadataQuery mq) {
  RelOptCost cost = mq.getNonCumulativeCost(rel);
  List<RelNode> inputs = rel.getInputs();
  RelOptCost maxICost = HiveCost.ZERO;
  for (RelNode input : inputs) {
   RelOptCost iCost = mq.getCumulativeCost(input);
   if (maxICost.isLt(iCost)) {
    maxICost = iCost;
   }
  }
  return cost.plus(maxICost);
 }
}
origin: apache/hive

RelOptCost afterCost = mq.getCumulativeCost(r);
RelOptCost beforeCost = mq.getCumulativeCost(aggregate);
if (afterCost.isLt(beforeCost)) {
 call.transformTo(r);
origin: apache/drill

RelOptCost afterCost = mq.getCumulativeCost(r);
RelOptCost beforeCost = mq.getCumulativeCost(aggregate);
if (afterCost.isLt(beforeCost)) {
 call.transformTo(r);
origin: Qihoo360/Quicksql

public RelOptCost getCost(RelNode rel, RelMetadataQuery mq) {
 return mq.getCumulativeCost(rel);
}
origin: org.apache.calcite/calcite-core

public RelOptCost getCost(RelNode rel, RelMetadataQuery mq) {
 return mq.getCumulativeCost(rel);
}
origin: Qihoo360/Quicksql

 public int compare(Integer rel1Idx, Integer rel2Idx) {
  RelOptCost c1 =
    mq.getCumulativeCost(chosenSemiJoins[rel1Idx]);
  RelOptCost c2 =
    mq.getCumulativeCost(chosenSemiJoins[rel2Idx]);
  // nulls are arbitrarily sorted
  if ((c1 == null) || (c2 == null)) {
   return -1;
  }
  return (c1.isLt(c2)) ? -1 : ((c1.equals(c2)) ? 0 : 1);
 }
}
origin: org.apache.calcite/calcite-core

 public int compare(Integer rel1Idx, Integer rel2Idx) {
  RelOptCost c1 =
    mq.getCumulativeCost(chosenSemiJoins[rel1Idx]);
  RelOptCost c2 =
    mq.getCumulativeCost(chosenSemiJoins[rel2Idx]);
  // nulls are arbitrarily sorted
  if ((c1 == null) || (c2 == null)) {
   return -1;
  }
  return (c1.isLt(c2)) ? -1 : ((c1.equals(c2)) ? 0 : 1);
 }
}
origin: org.apache.drill.exec/drill-java-exec

 @Override
 public Double visitPrel(Prel prel, Void value) throws RuntimeException {
  RelMetadataQuery mq = RelMetadataQuery.instance();
  return ((DrillCostBase) mq.getCumulativeCost(prel)).getMemory();
//    return findCost(prel, mq);
 }

origin: Qihoo360/Quicksql

public RelOptCost getCumulativeCost(RelNode rel, RelMetadataQuery mq) {
 RelOptCost cost = mq.getNonCumulativeCost(rel);
 List<RelNode> inputs = rel.getInputs();
 for (RelNode input : inputs) {
  cost = cost.plus(mq.getCumulativeCost(input));
 }
 return cost;
}
origin: org.apache.calcite/calcite-core

public RelOptCost getCumulativeCost(RelNode rel, RelMetadataQuery mq) {
 RelOptCost cost = mq.getNonCumulativeCost(rel);
 List<RelNode> inputs = rel.getInputs();
 for (RelNode input : inputs) {
  cost = cost.plus(mq.getCumulativeCost(input));
 }
 return cost;
}
origin: Qihoo360/Quicksql

.append(mq.getRowCount(rel))
.append(", cumulative cost = ")
.append(mq.getCumulativeCost(rel));
origin: com.facebook.presto.hive/hive-apache

 public RelOptCost getCumulativeCost(HiveJoin rel) {
  RelOptCost cost = RelMetadataQuery.getNonCumulativeCost(rel);
  List<RelNode> inputs = rel.getInputs();
  RelOptCost maxICost = HiveCost.ZERO;
  for (RelNode input : inputs) {
   RelOptCost iCost = RelMetadataQuery.getCumulativeCost(input);
   if (maxICost.isLt(iCost)) {
    maxICost = iCost;
   }
  }
  return cost.plus(maxICost);
 }
}
origin: dremio/dremio-oss

@Override
public RelNode visit(final TableScan scan) {
 final Optional<MaterializationDescriptor> descriptor = table.getDescriptor(scan.getTable().getQualifiedName());
 if (descriptor.isPresent()) {
  // Always use metadataQuery from the cluster (do not use calcite's default CALCITE_INSTANCE)
  final RelOptCost cost = scan.getCluster().getMetadataQuery().getCumulativeCost(scan);
  final double acceleratedCost = DremioCost.aggregateCost(cost);
  final double originalCost = descriptor.get().getOriginalCost();
  final double speedUp = originalCost/acceleratedCost;
  builder.addSubstitution(new SubstitutionInfo.Substitution(descriptor.get(), speedUp));
 }
 return super.visit(scan);
}
origin: dremio/dremio-oss

final RelOptCost cost = root.getCluster().getMetadataQuery().getCumulativeCost(root);
final double acceleratedCost  = DremioCost.aggregateCost(cost);
builder.setCost(acceleratedCost);
origin: dremio/dremio-oss

@Override
public void planRelTransform(PlannerPhase phase, RelOptPlanner planner, RelNode before, RelNode after, long millisTaken) {
 switch(phase){
 case JOIN_PLANNING_MULTI_JOIN:
  // Join optimization starts with multijoin analysis phase
  builder.addPreJoinPlan(before);
  break;
 case LOGICAL:
  builder.addLogicalPlan(before, after);
  // Always use metadataQuery from the cluster (do not use calcite's default CALCITE_INSTANCE)
  final RelOptCost cost = before.getCluster().getMetadataQuery().getCumulativeCost(after);
  // set final pre-accelerated cost
  builder.addCost(cost);
  break;
 default:
  // noop.
 }
}
origin: dremio/dremio-oss

@Override
public void planRelTransform(PlannerPhase phase, RelOptPlanner planner, RelNode before, RelNode after, long millisTaken) {
 statusListener.planRelTransform(phase, before, after, millisTaken);
 switch(phase){
 case LOGICAL:
  builder.addLogicalPlan(before, after);
  // set final pre-accelerated cost
  final RelOptCost cost = after.getCluster().getMetadataQuery().getCumulativeCost(after);
  builder.addCost(cost);
  break;
 case JOIN_PLANNING_MULTI_JOIN:
  // Join planning starts with multi-join analysis phase
  builder.addPreJoinPlan(before);
  break;
 default:
  return;
 }
}
origin: dremio/dremio-oss

protected void explain_(RelNode rel, List<Pair<String, Object>> values) {
 final Map<String, Object> map = Maps.newLinkedHashMap(); // need the ordering
 RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
 putIntoMap(map, "op", relJson.classToTypeName(rel.getClass()));
 final Map<String, Object> valuesMap = jsonBuilder.map();
 for (Pair<String, Object> value : values) {
  if (value.right instanceof RelNode) {
   continue;
  }
  putIntoMap(valuesMap, value.left, escapeSpecialChars(String.valueOf(value.right)));
 }
 putIntoMap(map, "values", valuesMap);
 final List<String> inputOpIds = getInputOpIds(rel.getInputs());
 putIntoMap(map, "inputs", inputOpIds);
 putIntoMap(map, "rowType", escapeSpecialChars(String.valueOf(rel.getRowType())));
 putIntoMap(map, "rowCount", mq.getRowCount(rel));
 putIntoMap(map, "cumulativeCost", escapeSpecialChars(String.valueOf(mq.getCumulativeCost(rel))));
 final OpId opId = ids.get(rel);
 putIntoMap(relExplainMap, String.format("%02d-%02d", opId.getFragmentId(), opId.getOpId()), map);
 explainInputs(rel.getInputs());
}
origin: Qihoo360/Quicksql

@Test public void testOne() throws Exception {
 RelNode planned = run(new PropAction(), RULES);
 if (CalcitePrepareImpl.DEBUG) {
  System.out.println(
    RelOptUtil.dumpPlan("LOGICAL PLAN", planned, SqlExplainFormat.TEXT,
      SqlExplainLevel.ALL_ATTRIBUTES));
 }
 final RelMetadataQuery mq = RelMetadataQuery.instance();
 assertEquals("Sortedness was not propagated", 3,
   mq.getCumulativeCost(planned).getRows(), 0);
}
origin: org.apache.calcite/calcite-core

@Test public void testOne() throws Exception {
 RelNode planned = run(new PropAction(), RULES);
 if (CalcitePrepareImpl.DEBUG) {
  System.out.println(
    RelOptUtil.dumpPlan("LOGICAL PLAN", planned, SqlExplainFormat.TEXT,
      SqlExplainLevel.ALL_ATTRIBUTES));
 }
 final RelMetadataQuery mq = RelMetadataQuery.instance();
 assertEquals("Sortedness was not propagated", 3,
   mq.getCumulativeCost(planned).getRows(), 0);
}
org.apache.calcite.rel.metadataRelMetadataQuerygetCumulativeCost

Javadoc

Returns the BuiltInMetadata.CumulativeCost#getCumulativeCost()statistic.

Popular methods of RelMetadataQuery

  • getRowCount
    Returns the BuiltInMetadata.RowCount#getRowCount()statistic.
  • getPulledUpPredicates
    Returns the BuiltInMetadata.Predicates#getPredicates()statistic.
  • getColumnOrigins
    Returns the BuiltInMetadata.ColumnOrigin#getColumnOrigins(int)statistic.
  • getDistinctRowCount
    Returns the BuiltInMetadata.DistinctRowCount#getDistinctRowCount(ImmutableBitSet,RexNode)statistic.
  • areColumnsUnique
    Returns the BuiltInMetadata.ColumnUniqueness#areColumnsUnique(ImmutableBitSet,boolean)statistic.
  • collations
  • cumulativeMemoryWithinPhase
    Returns the BuiltInMetadata.Memory#cumulativeMemoryWithinPhase()statistic.
  • getAverageColumnSizes
    Returns the BuiltInMetadata.Size#averageColumnSizes()statistic.
  • getNonCumulativeCost
    Returns the BuiltInMetadata.NonCumulativeCost#getNonCumulativeCost()statistic.
  • getUniqueKeys
    Returns the BuiltInMetadata.UniqueKeys#getUniqueKeys(boolean)statistic.
  • isPhaseTransition
    Returns the BuiltInMetadata.Parallelism#isPhaseTransition()statistic.
  • memory
    Returns the BuiltInMetadata.Memory#memory()statistic.
  • isPhaseTransition,
  • memory,
  • splitCount,
  • getSelectivity,
  • instance,
  • distribution,
  • getAverageRowSize,
  • getExpressionLineage,
  • getMaxRowCount

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
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