当前位置: 首页>>代码示例>>Java>>正文


Java RexProgram.getCondition方法代码示例

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


在下文中一共展示了RexProgram.getCondition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitCalc

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
public Result visitCalc(Calc e) {
  Result x = visitChild(0, e.getInput());
  final RexProgram program = e.getProgram();
  Builder builder =
      program.getCondition() != null
          ? x.builder(e, Clause.WHERE)
          : x.builder(e);
  if (!isStar(program)) {
    final List<SqlNode> selectList = new ArrayList<>();
    for (RexLocalRef ref : program.getProjectList()) {
      SqlNode sqlExpr = builder.context.toSql(program, ref);
      addSelect(selectList, sqlExpr, e.getRowType());
    }
    builder.setSelect(new SqlNodeList(selectList, POS));
  }

  if (program.getCondition() != null) {
    builder.setWhere(
        builder.context.toSql(program, program.getCondition()));
  }
  return builder.result();
}
 
开发者ID:qubole,项目名称:quark,代码行数:23,代码来源:RelToSqlConverter.java

示例2: visit

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
/** @see #dispatch */
public Result visit(Calc e) {
  Result x = visitChild(0, e.getInput());
  parseCorrelTable(e, x);
  final RexProgram program = e.getProgram();
  Builder builder =
      program.getCondition() != null
          ? x.builder(e, Clause.WHERE)
          : x.builder(e);
  if (!isStar(program)) {
    final List<SqlNode> selectList = new ArrayList<>();
    for (RexLocalRef ref : program.getProjectList()) {
      SqlNode sqlExpr = builder.context.toSql(program, ref);
      addSelect(selectList, sqlExpr, e.getRowType());
    }
    builder.setSelect(new SqlNodeList(selectList, POS));
  }

  if (program.getCondition() != null) {
    builder.setWhere(
        builder.context.toSql(program, program.getCondition()));
  }
  return builder.result();
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RelToSqlConverter.java

示例3: translateCondition

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
public static Expression translateCondition(
    RexProgram program,
    JavaTypeFactory typeFactory,
    BlockBuilder list,
    InputGetter inputGetter,
    Function1<String, InputGetter> correlates) {
  if (program.getCondition() == null) {
    return RexImpTable.TRUE_EXPR;
  }
  final ParameterExpression root = DataContext.ROOT;
  RexToLixTranslator translator =
      new RexToLixTranslator(program, typeFactory, root, inputGetter, list);
  translator = translator.setCorrelates(correlates);
  return translator.translate(
      program.getCondition(),
      RexImpTable.NullAs.FALSE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:18,代码来源:RexToLixTranslator.java

示例4: estimateFilteredRows

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
public static double estimateFilteredRows(RelNode child, RexProgram program,
    RelMetadataQuery mq) {
  // convert the program's RexLocalRef condition to an expanded RexNode
  RexLocalRef programCondition = program.getCondition();
  RexNode condition;
  if (programCondition == null) {
    condition = null;
  } else {
    condition = program.expandLocalRef(programCondition);
  }
  return estimateFilteredRows(child, condition, mq);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:RelMdUtil.java

示例5: canImplement

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
/**
 * Returns whether this tester's <code>RelType</code> can implement a
 * given program.
 *
 * @param program Program
 * @return Whether this tester's <code>RelType</code> can implement a
 * given program.
 */
public boolean canImplement(RexProgram program) {
  if ((program.getCondition() != null)
      && !canImplement(program.getCondition(), true)) {
    return false;
  }
  for (RexNode expr : program.getExprList()) {
    if (!canImplement(expr, false)) {
      return false;
    }
  }
  return true;
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:CalcRelSplitter.java

示例6: rewriteRel

import org.apache.calcite.rex.RexProgram; //导入方法依赖的package包/类
public void rewriteRel(LogicalCalc rel) {
  // Translate the child.
  final RelNode newInput = getNewForOldRel(rel.getInput());

  final RelOptCluster cluster = rel.getCluster();
  RexProgramBuilder programBuilder =
      new RexProgramBuilder(
          newInput.getRowType(),
          cluster.getRexBuilder());

  // Convert the common expressions.
  final RexProgram program = rel.getProgram();
  final RewriteRexShuttle shuttle = new RewriteRexShuttle();
  for (RexNode expr : program.getExprList()) {
    programBuilder.registerInput(expr.accept(shuttle));
  }

  // Convert the projections.
  final List<Pair<RexNode, String>> flattenedExpList = Lists.newArrayList();
  List<String> fieldNames = rel.getRowType().getFieldNames();
  flattenProjections(new RewriteRexShuttle(),
      program.getProjectList(),
      fieldNames,
      "",
      flattenedExpList);

  // Register each of the new projections.
  for (Pair<RexNode, String> flattenedExp : flattenedExpList) {
    programBuilder.addProject(flattenedExp.left, flattenedExp.right);
  }

  // Translate the condition.
  final RexLocalRef conditionRef = program.getCondition();
  if (conditionRef != null) {
    programBuilder.addCondition(
        new RexLocalRef(
            getNewForOldInput(conditionRef.getIndex()),
            conditionRef.getType()));
  }

  RexProgram newProgram = programBuilder.getProgram();

  // Create a new calc relational expression.
  LogicalCalc newRel = LogicalCalc.create(newInput, newProgram);
  setNewForOldRel(rel, newRel);
}
 
开发者ID:apache,项目名称:calcite,代码行数:47,代码来源:RelStructuredTypeFlattener.java


注:本文中的org.apache.calcite.rex.RexProgram.getCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。