• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Calc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visitCalc

import org.apache.calcite.rel.core.Calc; //导入依赖的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: CalcRelSplitter

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * Constructs a CalcRelSplitter.
 *
 * @param calc     Calc to split
 * @param relTypes Array of rel types, e.g. {Java, Fennel}. Must be
 *                 distinct.
 */
CalcRelSplitter(Calc calc, RelBuilder relBuilder, RelType[] relTypes) {
  this.relBuilder = relBuilder;
  for (int i = 0; i < relTypes.length; i++) {
    assert relTypes[i] != null;
    for (int j = 0; j < i; j++) {
      assert relTypes[i] != relTypes[j]
          : "Rel types must be distinct";
    }
  }
  this.program = calc.getProgram();
  this.cluster = calc.getCluster();
  this.traits = calc.getTraitSet();
  this.typeFactory = calc.getCluster().getTypeFactory();
  this.child = calc.getInput();
  this.relTypes = relTypes;
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:CalcRelSplitter.java


示例3: visit

import org.apache.calcite.rel.core.Calc; //导入依赖的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


示例4: traverse

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public final T traverse(RelNode n) throws Exception {
  List<T> inputStreams = new ArrayList<>();
  for (RelNode input : n.getInputs()) {
    inputStreams.add(traverse(input));
  }

  if (n instanceof Aggregate) {
    return visitAggregate((Aggregate) n, inputStreams);
  } else if (n instanceof Calc) {
    return visitCalc((Calc) n, inputStreams);
  } else if (n instanceof Collect) {
    return visitCollect((Collect) n, inputStreams);
  } else if (n instanceof Correlate) {
    return visitCorrelate((Correlate) n, inputStreams);
  } else if (n instanceof Delta) {
    return visitDelta((Delta) n, inputStreams);
  } else if (n instanceof Exchange) {
    return visitExchange((Exchange) n, inputStreams);
  } else if (n instanceof Project) {
    return visitProject((Project) n, inputStreams);
  } else if (n instanceof Filter) {
    return visitFilter((Filter) n, inputStreams);
  } else if (n instanceof Sample) {
    return visitSample((Sample) n, inputStreams);
  } else if (n instanceof Sort) {
    return visitSort((Sort) n, inputStreams);
  } else if (n instanceof TableModify) {
    return visitTableModify((TableModify) n, inputStreams);
  } else if (n instanceof TableScan) {
    return visitTableScan((TableScan) n, inputStreams);
  } else if (n instanceof Uncollect) {
    return visitUncollect((Uncollect) n, inputStreams);
  } else if (n instanceof Window) {
    return visitWindow((Window) n, inputStreams);
  } else if (n instanceof Join) {
    return visitJoin((Join) n, inputStreams);
  } else {
    return defaultValue(n, inputStreams);
  }
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:41,代码来源:PostOrderRelNodeVisitor.java


示例5: visitChild

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public Result visitChild(int i, RelNode e) {
  if (e instanceof Union) {
    return visitUnion((Union) e);
  } else if (e instanceof Join) {
    return visitJoin((Join) e);
  } else if (e instanceof Filter) {
    return visitFilter((Filter) e);
  } else if (e instanceof Project) {
    return visitProject((Project) e);
  } else if (e instanceof Aggregate) {
    return visitAggregate((Aggregate) e);
  } else if (e instanceof TableScan) {
    return visitTableScan((TableScan) e);
  } else if (e instanceof Intersect) {
    return visitIntersect((Intersect) e);
  } else if (e instanceof Minus) {
    return visitMinus((Minus) e);
  } else if (e instanceof Calc) {
    return visitCalc((Calc) e);
  } else if (e instanceof Sort) {
    return visitSort((Sort) e);
  } else if (e instanceof TableModify) {
    return visitTableModify((TableModify) e);
  } else if (e instanceof Limit) {
    return visitLimit((Limit) e);
  } else {
    throw new AssertionError("Need to Implement for " + e.getClass().getName()); // TODO:
  }
}
 
开发者ID:qubole,项目名称:quark,代码行数:30,代码来源:RelToSqlConverter.java


示例6: getRowCount

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
@Override
public Double getRowCount(Calc rel, RelMetadataQuery mq) {
    if (shouldIntercept(rel))
        return 1E10;

    return super.getRowCount(rel, mq);
}
 
开发者ID:apache,项目名称:kylin,代码行数:8,代码来源:OLAPRelMdRowCount.java


示例7: CalcMergeRule

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * Creates a CalcMergeRule.
 *
 * @param relBuilderFactory Builder for relational expressions
 */
public CalcMergeRule(RelBuilderFactory relBuilderFactory) {
  super(
      operand(
          Calc.class,
          operand(Calc.class, any())),
      relBuilderFactory, null);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:CalcMergeRule.java


示例8: onMatch

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
@Override public void onMatch(RelOptRuleCall call) {
  final Calc calc = call.rel(0);
  final Pair<ImmutableList<RexNode>, ImmutableList<RexNode>> projectFilter =
      calc.getProgram().split();
  final RelBuilder relBuilder = call.builder();
  relBuilder.push(calc.getInput());
  relBuilder.filter(projectFilter.right);
  relBuilder.project(projectFilter.left, calc.getRowType().getFieldNames());
  call.transformTo(relBuilder.build());
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:CalcSplitRule.java


示例9: visitCalc

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public T visitCalc(Calc calc, List<T> inputStreams) throws Exception {
  return defaultValue(calc, inputStreams);
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:4,代码来源:PostOrderRelNodeVisitor.java


示例10: onMatch

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final Join joinRel = call.rel(0);
  final RelNode otherNode;
  final Calc calc;

  final RelNode leftJoinChild;
  final RelNode rightJoinChild;

  if (call.rel(1) instanceof Calc) {
    otherNode = call.rel(2);
    calc = call.rel(1);
    rightJoinChild = otherNode;
    leftJoinChild = calc.getInput();
  } else {
    otherNode = call.rel(1);
    calc = call.rel(2);
    rightJoinChild = calc.getInput();
    leftJoinChild = otherNode;
  }
  /**
   * Currently not supporting calc which doesnot
   * project star (all the columns of input)
   * or has aggregates.
   */
  if (!isStar(calc.getProgram())
      || calc.getProgram().containsAggs()) {
    return;
  }

  final List<RelDataTypeField> origFields =
      calc.getRowType().getFieldList();
  final int[] adjustments = new int[calc.getProgram().getExprCount()];
  if (rightJoinChild == calc.getInput()) {
    int offset = leftJoinChild.getRowType().getFieldList().size();
    for (int i = 0; i < origFields.size(); i++) {
      adjustments[i] = offset;
    }
  }
  Join newJoinRel =
      joinRel.copy(joinRel.getTraitSet(), joinRel.getCondition(),
          leftJoinChild, rightJoinChild, joinRel.getJoinType(),
          joinRel.isSemiJoinDone());

  RexProgramBuilder topProgramBuilder =
      new RexProgramBuilder(
          joinRel.getRowType(),
          joinRel.getCluster().getRexBuilder());
  topProgramBuilder.addIdentity();
  final RelOptUtil.RexInputConverter rexInputConverter =
      new RelOptUtil.RexInputConverter(calc.getCluster().getRexBuilder(),
          origFields,
          joinRel.getRowType().getFieldList(),
          adjustments);
  if (calc.getProgram().getCondition() != null) {
    RexNode cond =
        calc.getProgram().expandLocalRef(calc.getProgram().getCondition());
    final RexLocalRef rexLocalRef =
        topProgramBuilder.addExpr(cond.accept(rexInputConverter));
    topProgramBuilder.addCondition(rexLocalRef);
  }
  Calc newCalcRel =
      calc.copy(calc.getTraitSet(), newJoinRel, topProgramBuilder.getProgram());

  call.transformTo(newCalcRel);
}
 
开发者ID:qubole,项目名称:quark,代码行数:66,代码来源:JoinCalcTransposeRule.java


示例11: getNodeTypes

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public Multimap<Class<? extends RelNode>, RelNode> getNodeTypes(Calc rel,
    RelMetadataQuery mq) {
  return getNodeTypes(rel, Calc.class, mq);
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:RelMdNodeTypes.java


示例12: collations

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public ImmutableList<RelCollation> collations(Calc calc,
    RelMetadataQuery mq) {
  return ImmutableList.copyOf(calc(mq, calc.getInput(), calc.getProgram()));
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:RelMdCollation.java


示例13: getRowCount

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
public Double getRowCount(Calc rel, RelMetadataQuery mq) {
  return RelMdUtil.estimateFilteredRows(rel.getInput(), rel.getProgram(), mq);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:RelMdRowCount.java


示例14: CalcReduceExpressionsRule

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
@Deprecated // to be removed before 2.0
public CalcReduceExpressionsRule(Class<? extends Calc> calcClass,
    RelBuilderFactory relBuilderFactory) {
  this(calcClass, true, relBuilderFactory);
}
 
开发者ID:apache,项目名称:calcite,代码行数:6,代码来源:ReduceExpressionsRule.java


示例15: CalcToWindowRule

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * Creates a CalcToWindowRule.
 *
 * @param relBuilderFactory Builder for relational expressions
 */
public CalcToWindowRule(RelBuilderFactory relBuilderFactory) {
  super(
      operand(Calc.class, null, PREDICATE, any()),
      relBuilderFactory, "ProjectToWindowRule");
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:ProjectToWindowRule.java


示例16: WindowedAggRelSplitter

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
WindowedAggRelSplitter(Calc calc, RelBuilder relBuilder) {
  super(calc, relBuilder, REL_TYPES);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:ProjectToWindowRule.java


示例17: createEmptyRelOrEquivalent

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * Drills schema flexibility requires us to override the default behavior of calcite
 * to produce an EmptyRel in the case of a constant false filter. We need to propagate
 * schema at runtime, so we cannot just produce a simple operator at planning time to
 * expose the planning time known schema. Instead we have to insert a limit 0.
 */
@Override
protected RelNode createEmptyRelOrEquivalent(Calc calc) {
  return createEmptyEmptyRelHelper(calc);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:DrillReduceExpressionsRule.java


示例18: createEmptyRelOrEquivalent

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * For static schema systems, a filter that is always false or null can be
 * replaced by a values operator that produces no rows, as the schema
 * information can just be taken from the input Rel. In dynamic schema
 * environments, the filter might have an unknown input type, in these cases
 * they must define a system specific alternative to a Values operator, such
 * as inserting a limit 0 instead of a filter on top of the original input.
 *
 * <p>The default implementation of this method is to call
 * {@link RelBuilder#empty}, which for the static schema will be optimized
 * to an empty
 * {@link org.apache.calcite.rel.core.Values}.
 *
 * @param input rel to replace, assumes caller has already determined
 *              equivalence to Values operation for 0 records or a
 *              false filter.
 * @return equivalent but less expensive replacement rel
 */
protected RelNode createEmptyRelOrEquivalent(RelOptRuleCall call, Calc input) {
  return call.builder().push(input).empty().build();
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:ReduceExpressionsRule.java


示例19: CalcSplitRule

import org.apache.calcite.rel.core.Calc; //导入依赖的package包/类
/**
 * Creates a CalcSplitRule.
 *
 * @param relBuilderFactory Builder for relational expressions
 */
public CalcSplitRule(RelBuilderFactory relBuilderFactory) {
  super(operand(Calc.class, any()), relBuilderFactory, null);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:CalcSplitRule.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SmoothBursty类代码示例发布时间:2022-05-23
下一篇:
Java MessageSummary类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap