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


Java InvalidRelException类代码示例

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


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

示例1: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalAggregate aggregate = (LogicalAggregate) call.rel(0);
  final RelNode input = call.rel(1);

  if (aggregate.containsDistinctCall()) {
    // currently, don't use this rule if any of the aggregates contains DISTINCT
    return;
  }

  final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
  try {
    call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator,
        aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList()));
  } catch (InvalidRelException e) {
    tracer.warning(e.toString());
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:DrillAggregateRule.java

示例2: convert

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
public static DrillJoinRel convert(Join join, ConversionContext context) throws InvalidRelException{
  RelNode left = context.toRel(join.getLeft());
  RelNode right = context.toRel(join.getRight());

  List<RexNode> joinConditions = new ArrayList<RexNode>();
  // right fields appear after the LHS fields.
  final int rightInputOffset = left.getRowType().getFieldCount();
  for (JoinCondition condition : join.getConditions()) {
    RelDataTypeField leftField = left.getRowType().getField(ExprHelper.getFieldName(condition.getLeft()), true, false);
    RelDataTypeField rightField = right.getRowType().getField(ExprHelper.getFieldName(condition.getRight()), true, false);
      joinConditions.add(
          context.getRexBuilder().makeCall(
              SqlStdOperatorTable.EQUALS,
              context.getRexBuilder().makeInputRef(leftField.getType(), leftField.getIndex()),
              context.getRexBuilder().makeInputRef(rightField.getType(), rightInputOffset + rightField.getIndex())
              )
              );
  }
  RexNode rexCondition = RexUtil.composeConjunction(context.getRexBuilder(), joinConditions, false);
  DrillJoinRel joinRel = new DrillJoinRel(context.getCluster(), context.getLogicalTraits(), left, right, rexCondition, join.getJoinType());

  return joinRel;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:DrillJoinRel.java

示例3: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalUnion union = (LogicalUnion) call.rel(0);

  // This rule applies to Union-All only
  if(!union.all) {
    return;
  }

  final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  final List<RelNode> convertedInputs = new ArrayList<>();
  for (RelNode input : union.getInputs()) {
    final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
    convertedInputs.add(convertedInput);
  }
  try {
    call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
        true /* check compatibility */));
  } catch (InvalidRelException e) {
    tracer.warning(e.toString()) ;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:DrillUnionAllRule.java

示例4: convert

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException{

    // if there are compound expressions in the order by, we need to convert into projects on either side.
    RelNode input = context.toRel(order.getInput());
    List<String> fields = input.getRowType().getFieldNames();

    // build a map of field names to indices.
    Map<String, Integer> fieldMap = Maps.newHashMap();
    int i =0;
    for(String field : fields){
      fieldMap.put(field, i);
      i++;
    }

    List<RelFieldCollation> collations = Lists.newArrayList();

    for(Ordering o : order.getOrderings()){
      String fieldName = ExprHelper.getFieldName(o.getExpr());
      int fieldId = fieldMap.get(fieldName);
      RelFieldCollation c = new RelFieldCollation(fieldId, o.getDirection(), o.getNullDirection());
    }
    return new DrillSortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollationImpl.of(collations));
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:DrillSortRel.java

示例5: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final DrillUnionRel union = (DrillUnionRel) call.rel(0);
  final List<RelNode> inputs = union.getInputs();
  List<RelNode> convertedInputList = Lists.newArrayList();
  RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL);

  try {
    for (int i = 0; i < inputs.size(); i++) {
      RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits));
      convertedInputList.add(convertedInput);
    }

    traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON);
    UnionDistinctPrel unionDistinct =
        new UnionDistinctPrel(union.getCluster(), traits, convertedInputList,
            false /* compatibility already checked during logical phase */);

    call.transformTo(unionDistinct);

  } catch (InvalidRelException e) {
    tracer.warning(e.toString());
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:25,代码来源:UnionDistinctPrule.java

示例6: createTransformRequest

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
private void createTransformRequest(RelOptRuleCall call, DrillAggregateRel aggregate,
                                    RelNode input, RelTraitSet traits) throws InvalidRelException {

  final RelNode convertedInput = convert(input, traits);

  StreamAggPrel newAgg = new StreamAggPrel(
      aggregate.getCluster(),
      traits,
      convertedInput,
      aggregate.indicator,
      aggregate.getGroupSet(),
      aggregate.getGroupSets(),
      aggregate.getAggCallList(),
      OperatorPhase.PHASE_1of1);

  call.transformTo(newAgg);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:StreamAggPrule.java

示例7: createTransformRequest

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
private void createTransformRequest(RelOptRuleCall call, DrillAggregateRel aggregate,
                                    RelNode input, RelTraitSet traits) throws InvalidRelException {

  final RelNode convertedInput = convert(input, PrelUtil.fixTraits(call, traits));

  HashAggPrel newAgg = new HashAggPrel(
      aggregate.getCluster(),
      traits,
      convertedInput,
      aggregate.indicator,
      aggregate.getGroupSet(),
      aggregate.getGroupSets(),
      aggregate.getAggCallList(),
      OperatorPhase.PHASE_1of1);

  call.transformTo(newAgg);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:HashAggPrule.java

示例8: convertChild

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
    public RelNode convertChild(final DrillJoinRel join,  final RelNode rel) throws InvalidRelException {
      DrillDistributionTrait toDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE);
      RelTraitSet newTraitsLeft = newTraitSet(Prel.DRILL_PHYSICAL, toDist);
      RelNode newLeft = convert(left, newTraitsLeft);
      return new HashJoinPrel(join.getCluster(), newTraitsLeft, newLeft, convertedRight, joinCondition,
                                   join.getJoinType());

    }

  }.go(join, convertedLeft);
} else if (physicalJoinType == PhysicalJoinType.NESTEDLOOP_JOIN) {
  new SubsetTransformer<DrillJoinRel, InvalidRelException>(call) {

    @Override
    public RelNode convertChild(final DrillJoinRel join,  final RelNode rel) throws InvalidRelException {
      DrillDistributionTrait toDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE);
      RelTraitSet newTraitsLeft = newTraitSet(Prel.DRILL_PHYSICAL, toDist);
      RelNode newLeft = convert(left, newTraitsLeft);
      return new NestedLoopJoinPrel(join.getCluster(), newTraitsLeft, newLeft, convertedRight, joinCondition,
                                   join.getJoinType());
    }

  }.go(join, convertedLeft);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:26,代码来源:JoinPruleBase.java

示例9: convert

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException{

    // if there are compound expressions in the order by, we need to convert into projects on either side.
    RelNode input = context.toRel(order.getInput());
    List<String> fields = input.getRowType().getFieldNames();

    // build a map of field names to indices.
    Map<String, Integer> fieldMap = Maps.newHashMap();
    int i =0;
    for(String field : fields){
      fieldMap.put(field, i);
      i++;
    }

    List<RelFieldCollation> collations = Lists.newArrayList();

    for(Ordering o : order.getOrderings()){
      String fieldName = ExprHelper.getFieldName(o.getExpr());
      int fieldId = fieldMap.get(fieldName);
      RelFieldCollation c = new RelFieldCollation(fieldId, o.getDirection(), o.getNullDirection());
    }
    return new SortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollationImpl.of(collations));
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:SortRel.java

示例10: convert

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
public static JoinRel convert(Join join, ConversionContext context) throws InvalidRelException{
  RelNode left = context.toRel(join.getLeft());
  RelNode right = context.toRel(join.getRight());

  List<RexNode> joinConditions = new ArrayList<RexNode>();
  // right fields appear after the LHS fields.
  final int rightInputOffset = left.getRowType().getFieldCount();
  for (JoinCondition condition : join.getConditions()) {
    RelDataTypeField leftField = left.getRowType().getField(ExprHelper.getFieldName(condition.getLeft()), true, false);
    RelDataTypeField rightField = right.getRowType().getField(ExprHelper.getFieldName(condition.getRight()), true, false);
      joinConditions.add(
          context.getRexBuilder().makeCall(
              SqlStdOperatorTable.EQUALS,
              context.getRexBuilder().makeInputRef(leftField.getType(), leftField.getIndex()),
              context.getRexBuilder().makeInputRef(rightField.getType(), rightInputOffset + rightField.getIndex())
              )
              );
  }
  RexNode rexCondition = RexUtil.composeConjunction(context.getRexBuilder(), joinConditions, false);
  JoinRel joinRel = new JoinRel(context.getCluster(), context.getLogicalTraits(), left, right, rexCondition, join.getJoinType());

  return joinRel;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:JoinRel.java

示例11: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalUnion union = (LogicalUnion) call.rel(0);

  // This rule applies to Union-All only
  if(!union.all) {
    return;
  }

  final RelTraitSet traits = union.getTraitSet().plus(Rel.LOGICAL);
  final List<RelNode> convertedInputs = new ArrayList<>();
  for (RelNode input : union.getInputs()) {
    final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify());
    convertedInputs.add(convertedInput);
  }
  try {
    call.transformTo(new UnionRel(union.getCluster(), traits, convertedInputs, union.all,
        true /* check compatibility */));
  } catch (InvalidRelException e) {
    tracer.warn(e.toString()) ;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:UnionAllRule.java

示例12: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final UnionRel union = (UnionRel) call.rel(0);
  final List<RelNode> inputs = union.getInputs();
  List<RelNode> convertedInputList = Lists.newArrayList();
  RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.PHYSICAL);

  try {
    for (int i = 0; i < inputs.size(); i++) {
      RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits));
      convertedInputList.add(convertedInput);
    }

    traits = call.getPlanner().emptyTraitSet().plus(Prel.PHYSICAL).plus(DistributionTrait.SINGLETON);
    UnionDistinctPrel unionDistinct =
        new UnionDistinctPrel(union.getCluster(), traits, convertedInputList,
            false /* compatibility already checked during logical phase */);

    call.transformTo(unionDistinct);

  } catch (InvalidRelException e) {
    tracer.warn(e.toString());
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:25,代码来源:UnionDistinctPrule.java

示例13: createTransformRequest

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
private void createTransformRequest(RelOptRuleCall call, AggregateRel aggregate,
                                    RelNode input, RelTraitSet traits) throws InvalidRelException {

  final RelNode convertedInput = convert(input, traits);

  StreamAggPrel newAgg = new StreamAggPrel(
      aggregate.getCluster(),
      traits,
      convertedInput,
      aggregate.indicator,
      aggregate.getGroupSet(),
      aggregate.getGroupSets(),
      aggregate.getAggCallList(),
      OperatorPhase.PHASE_1of1);

  call.transformTo(newAgg);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:StreamAggPrule.java

示例14: onMatch

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  PlannerSettings settings = PrelUtil.getPlannerSettings(call.getPlanner());
  if (!settings.isNestedLoopJoinEnabled()) {
    return;
  }

  final JoinRel join = (JoinRel) call.rel(0);
  final RelNode left = join.getLeft();
  final RelNode right = join.getRight();

  if (!checkPreconditions(join, left, right, settings)) {
    return;
  }

  try {

    if (checkBroadcastConditions(call.getPlanner(), join, left, right)) {
      createBroadcastPlan(call, join, join.getCondition(), PhysicalJoinType.NESTEDLOOP_JOIN,
          left, right, null /* left collation */, null /* right collation */);
    }

  } catch (InvalidRelException e) {
    tracer.warn(e.toString());
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:NestedLoopJoinPrule.java

示例15: createTransformRequest

import org.apache.calcite.rel.InvalidRelException; //导入依赖的package包/类
private void createTransformRequest(RelOptRuleCall call, AggregateRel aggregate,
                                    RelNode input, RelTraitSet traits) throws InvalidRelException {

  final RelNode convertedInput = convert(input, PrelUtil.fixTraits(call, traits));

  HashAggPrel newAgg = new HashAggPrel(
      aggregate.getCluster(),
      traits,
      convertedInput,
      aggregate.indicator,
      aggregate.getGroupSet(),
      aggregate.getGroupSets(),
      aggregate.getAggCallList(),
      OperatorPhase.PHASE_1of1);

  call.transformTo(newAgg);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:HashAggPrule.java


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