• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RexOver类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.calcite.rex.RexOver的典型用法代码示例。如果您正苦于以下问题:Java RexOver类的具体用法?Java RexOver怎么用?Java RexOver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RexOver类属于org.apache.calcite.rex包,在下文中一共展示了RexOver类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visitOver

点赞 3

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
public Boolean visitOver(RexOver over) {
  if (!visitCall(over)) {
    return false;
  }
  ;

  final RexWindow window = over.getWindow();
  for (RexFieldCollation orderKey : window.orderKeys) {
    if (!((RexNode) orderKey.left).accept(this)) {
      return false;
    }
  }

  for (RexNode partitionKey : window.partitionKeys) {
    if (!partitionKey.accept(this)) {
      return false;
    }
  }

  return true;

}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:23,
代码来源:JdbcExpressionCheck.java

示例2: addWindows

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
private static void addWindows(
    Multimap<WindowKey, RexOver> windowMap,
    RexOver over, final int inputFieldCount) {
  final RexWindow aggWindow = over.getWindow();

  // Look up or create a window.
  RelCollation orderKeys = getCollation(
      Lists.newArrayList(
          Iterables.filter(aggWindow.orderKeys,
            new PredicateImpl<RexFieldCollation>() {
              public boolean test(RexFieldCollation rexFieldCollation) {
                // If ORDER BY references constant (i.e. RexInputRef),
                // then we can ignore such ORDER BY key.
                return rexFieldCollation.left instanceof RexLocalRef;
              }
            })));
  ImmutableBitSet groupSet =
      ImmutableBitSet.of(getProjectOrdinals(aggWindow.partitionKeys));
  final int groupLength = groupSet.length();
  if (inputFieldCount < groupLength) {
    // If PARTITION BY references constant, we can ignore such partition key.
    // All the inputs after inputFieldCount are literals, thus we can clear.
    groupSet =
        groupSet.except(ImmutableBitSet.range(inputFieldCount, groupLength));
  }

  WindowKey windowKey =
      new WindowKey(
          groupSet, orderKeys, aggWindow.isRows(),
          aggWindow.getLowerBound(), aggWindow.getUpperBound());
  windowMap.put(windowKey, over);
}
 

开发者ID:apache,
项目名称:calcite,
代码行数:33,
代码来源:LogicalWindow.java

示例3: toSql

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
private SqlCall toSql(RexProgram program, RexOver rexOver) {
  final RexWindow rexWindow = rexOver.getWindow();
  final SqlNodeList partitionList = new SqlNodeList(
      toSql(program, rexWindow.partitionKeys), POS);

  ImmutableList.Builder<SqlNode> orderNodes = ImmutableList.builder();
  if (rexWindow.orderKeys != null) {
    for (RexFieldCollation rfc : rexWindow.orderKeys) {
      orderNodes.add(toSql(program, rfc));
    }
  }
  final SqlNodeList orderList =
      new SqlNodeList(orderNodes.build(), POS);

  final SqlLiteral isRows =
      SqlLiteral.createBoolean(rexWindow.isRows(), POS);

  final SqlNode lowerBound =
      createSqlWindowBound(rexWindow.getLowerBound());
  final SqlNode upperBound =
      createSqlWindowBound(rexWindow.getUpperBound());

  // null defaults to true.
  // During parsing the allowPartial == false (e.g. disallow partial)
  // is expand into CASE expression and is handled as a such.
  // Not sure if we can collapse this CASE expression back into
  // "disallow partial" and set the allowPartial = false.
  final SqlLiteral allowPartial = null;

  final SqlWindow sqlWindow = SqlWindow.create(null, null, partitionList,
      orderList, isRows, lowerBound, upperBound, allowPartial, POS);

  final List<SqlNode> nodeList = toSql(program, rexOver.getOperands());
  final SqlCall aggFunctionCall =
      rexOver.getAggOperator().createCall(POS, nodeList);

  return SqlStdOperatorTable.OVER.createCall(POS, aggFunctionCall,
      sqlWindow);
}
 

开发者ID:apache,
项目名称:calcite,
代码行数:40,
代码来源:SqlImplementor.java

示例4: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
public Void visitOver(RexOver over) {
  // assume NO_PUSH until proven otherwise
  analyzeCall(over, PushDirFilter.NO_PUSH);
  return null;
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:6,
代码来源:FindPartitionConditions.java

示例5: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public RexNode visitOver(RexOver over) {
  return over;
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:5,
代码来源:RewriteAsBinaryOperators.java

示例6: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public LogicalExpression visitOver(RexOver over) {
  return doUnknown(over);
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:5,
代码来源:DrillOptiq.java

示例7: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public Boolean visitOver(RexOver over) {
  return doUnknown(over);
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:5,
代码来源:DrillProjectRelBase.java

示例8: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public Boolean visitOver(RexOver over) {
  return list(over.getOperands());
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:RewriteProjectToFlattenRule.java

示例9: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public StateHolder visitOver(RexOver over) {
  return new StateHolder(Type.OTHER, over);
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:FindSimpleFilters.java

示例10: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public Boolean visitOver(RexOver over) {
  return false;
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:MoreRelOptUtil.java

示例11: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public Expression visitOver(RexOver over) {
  return super.visitOver(over);
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:PredicateAnalyzer.java

示例12: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public List<List<String>> visitOver(RexOver over) {
  return visitUnknown(over);
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:ElasticSourceNameFinder.java

示例13: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override
public FunctionRender visitOver(RexOver over) {
  return visitUnknown(over);
}
 

开发者ID:dremio,
项目名称:dremio-oss,
代码行数:5,
代码来源:ProjectAnalyzer.java

示例14: visitOver

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
@Override public Void visitOver(RexOver over) {
  // assume non-constant (running SUM(1) looks constant but isn't)
  analyzeCall(over, Constancy.NON_CONSTANT);
  return null;
}
 

开发者ID:apache,
项目名称:calcite,
代码行数:6,
代码来源:ReduceExpressionsRule.java

示例15: onMatch

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final Filter filter = call.rel(0);
  final Project project = call.rel(1);

  if (RexOver.containsOver(project.getProjects(), null)) {
    // In general a filter cannot be pushed below a windowing calculation.
    // Applying the filter before the aggregation function changes
    // the results of the windowing invocation.
    //
    // When the filter is on the PARTITION BY expression of the OVER clause
    // it can be pushed down. For now we don't support this.
    return;
  }

  if (RexUtil.containsCorrelation(filter.getCondition())) {
    // If there is a correlation condition anywhere in the filter, don't
    // push this filter past project since in some cases it can prevent a
    // Correlate from being de-correlated.
    return;
  }

  // convert the filter to one that references the child of the project
  RexNode newCondition =
      RelOptUtil.pushPastProject(filter.getCondition(), project);

  final RelBuilder relBuilder = call.builder();
  RelNode newFilterRel;
  if (copyFilter) {
    newFilterRel = filter.copy(filter.getTraitSet(), project.getInput(),
        RexUtil.removeNullabilityCast(relBuilder.getTypeFactory(),
            newCondition));
  } else {
    newFilterRel =
        relBuilder.push(project.getInput()).filter(newCondition).build();
  }

  RelNode newProjRel =
      copyProject
          ? project.copy(project.getTraitSet(), newFilterRel,
              project.getProjects(), project.getRowType())
          : relBuilder.push(newFilterRel)
              .project(project.getProjects(), project.getRowType().getFieldNames())
              .build();

  call.transformTo(newProjRel);
}
 

开发者ID:apache,
项目名称:calcite,
代码行数:47,
代码来源:FilterProjectTransposeRule.java

示例16: onMatch

点赞 2

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final LogicalProject project = call.rel(0);
  final LogicalCalc calc = call.rel(1);

  // Don't merge a project which contains windowed aggregates onto a
  // calc. That would effectively be pushing a windowed aggregate down
  // through a filter. Transform the project into an identical calc,
  // which we'll have chance to merge later, after the over is
  // expanded.
  final RelOptCluster cluster = project.getCluster();
  RexProgram program =
      RexProgram.create(
          calc.getRowType(),
          project.getProjects(),
          null,
          project.getRowType(),
          cluster.getRexBuilder());
  if (RexOver.containsOver(program)) {
    LogicalCalc projectAsCalc = LogicalCalc.create(calc, program);
    call.transformTo(projectAsCalc);
    return;
  }

  // Create a program containing the project node's expressions.
  final RexBuilder rexBuilder = cluster.getRexBuilder();
  final RexProgramBuilder progBuilder =
      new RexProgramBuilder(
          calc.getRowType(),
          rexBuilder);
  for (Pair<RexNode, String> field : project.getNamedProjects()) {
    progBuilder.addProject(field.left, field.right);
  }
  RexProgram topProgram = progBuilder.getProgram();
  RexProgram bottomProgram = calc.getProgram();

  // Merge the programs together.
  RexProgram mergedProgram =
      RexProgramBuilder.mergePrograms(
          topProgram,
          bottomProgram,
          rexBuilder);
  final LogicalCalc newCalc =
      LogicalCalc.create(calc.getInput(), mergedProgram);
  call.transformTo(newCalc);
}
 

开发者ID:apache,
项目名称:calcite,
代码行数:46,
代码来源:ProjectCalcMergeRule.java

示例17: computeSelfCost

点赞 1

import org.apache.calcite.rex.RexOver; //导入依赖的package包/类
/**
 * 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);
    return super.computeSelfCost(planner, mq).multiplyBy(.05)
            .multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1));
}
 

开发者ID:apache,
项目名称:kylin,
代码行数:14,
代码来源:OLAPProjectRel.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)