org.apache.calcite.rel.core.Project.computeSelfCost()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.calcite.rel.core.Project.computeSelfCost()方法的一些代码示例,展示了Project.computeSelfCost()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.computeSelfCost()方法的具体详情如下:
包路径:org.apache.calcite.rel.core.Project
类名称:Project
方法名:computeSelfCost

Project.computeSelfCost介绍

暂无

代码示例

代码示例来源:origin: apache/kylin

/**
 * Since the project under aggregate maybe reduce expressions by {@link org.apache.kylin.query.optrule.AggregateProjectReduceRule},
 * consider the count of expressions into cost, the reduced project will be used.
 *
 * Made RexOver much more expensive so we can transform into {@link org.apache.kylin.query.relnode.OLAPWindowRel}
 * by rules in {@link org.apache.calcite.rel.rules.ProjectToWindowRule}
 */
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
  boolean hasRexOver = RexOver.containsOver(getProjects(), null);
  RelOptCost relOptCost = super.computeSelfCost(planner, mq).multiplyBy(.05)
      .multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1))
      .plus(planner.getCostFactory().makeCost(0.1 * caseCount, 0, 0));
  return planner.getCostFactory().makeCost(relOptCost.getRows(), 0, 0);
}

代码示例来源:origin: Qihoo360/Quicksql

@Override public RelOptCost computeSelfCost(RelOptPlanner planner,
  RelMetadataQuery mq) {
 return super.computeSelfCost(planner, mq)
   .multiplyBy(JdbcConvention.COST_MULTIPLIER);
}

代码示例来源:origin: org.apache.calcite/calcite-core

@Override public RelOptCost computeSelfCost(RelOptPlanner planner,
  RelMetadataQuery mq) {
 return super.computeSelfCost(planner, mq)
   .multiplyBy(JdbcConvention.COST_MULTIPLIER);
}

代码示例来源:origin: Qihoo360/Quicksql

@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
 return super.computeSelfCost(planner, mq).multiplyBy(0.1);
}

代码示例来源:origin: org.apache.kylin/kylin-query

/**
 * Since the project under aggregate maybe reduce expressions by {@link org.apache.kylin.query.optrule.AggregateProjectReduceRule},
 * consider the count of expressions into cost, the reduced project will be used.
 *
 * Made RexOver much more expensive so we can transform into {@link org.apache.kylin.query.relnode.OLAPWindowRel}
 * by rules in {@link org.apache.calcite.rel.rules.ProjectToWindowRule}
 */
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
  boolean hasRexOver = RexOver.containsOver(getProjects(), null);
  RelOptCost relOptCost = super.computeSelfCost(planner, mq).multiplyBy(.05)
      .multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1))
      .plus(planner.getCostFactory().makeCost(0.1 * caseCount, 0, 0));
  return planner.getCostFactory().makeCost(relOptCost.getRows(), 0, 0);
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
 if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
  return super.computeSelfCost(planner, mq).multiplyBy(.1);
 }
 double rowCount = mq.getRowCount(this);
 // Attribute small cost for projecting simple fields. In reality projecting simple columns in not free and
 // this allows projection pushdown/project-merge rules to kick-in thereby eliminating unneeded columns from
 // the projection.
 double cpuCost = DrillCostBase.PROJECT_CPU_COST * rowCount * nonSimpleFieldCount
   + (this.getRowType().getFieldCount() - nonSimpleFieldCount) * rowCount * DrillCostBase.BASE_CPU_COST;
 DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
 return costFactory.makeCost(rowCount, cpuCost, 0, 0);
}

代码示例来源:origin: dremio/dremio-oss

@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery relMetadataQuery) {
 // Elasticsearch does not support contains() in project (only in filter).
 if (hasContains) {
  return planner.getCostFactory().makeInfiniteCost();
 }
 if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
  return super.computeSelfCost(planner).multiplyBy(.1);
 }
 // cost is proportional to the number of rows and number of columns being projected
 double rowCount = relMetadataQuery.getRowCount(this);
 // cpu is proportional to the number of columns and row count.  For complex expressions, we also add
 // additional cost for those columns (multiply by DremioCost.PROJECT_CPU_COST).
 double cpuCost = (DremioCost.PROJECT_SIMPLE_CPU_COST * rowCount * simpleFieldCount) + (DremioCost.PROJECT_CPU_COST * (nonSimpleFieldCount > 0 ? rowCount : 0) * nonSimpleFieldCount);
 Factory costFactory = (Factory) planner.getCostFactory();
 return costFactory.makeCost(rowCount, cpuCost, 0, 0);
}

相关文章