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


Java RelOptPlanner.CannotPlanException方法代码示例

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


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

示例1: convertToDrel

import org.apache.calcite.plan.RelOptPlanner; //导入方法依赖的package包/类
/**
 *  Given a relNode tree for SELECT statement, convert to Drill Logical RelNode tree.
 * @param relNode
 * @return
 * @throws SqlUnsupportedException
 * @throws RelConversionException
 */
protected DrillRel convertToDrel(RelNode relNode) throws SqlUnsupportedException, RelConversionException {
  try {
    final DrillRel convertedRelNode;

    if (! context.getPlannerSettings().isHepJoinOptEnabled()) {
      convertedRelNode = (DrillRel) logicalPlanningVolcano(relNode);
    } else {
      convertedRelNode = (DrillRel) logicalPlanningVolcanoAndLopt(relNode);
    }

    if (convertedRelNode instanceof DrillStoreRel) {
      throw new UnsupportedOperationException();
    } else {

      // If the query contains a limit 0 clause, disable distributed mode since it is overkill for determining schema.
      if (FindLimit0Visitor.containsLimit0(convertedRelNode)) {
        context.getPlannerSettings().forceSingleMode();
      }

      return convertedRelNode;
    }
  } catch (RelOptPlanner.CannotPlanException ex) {
    logger.error(ex.getMessage());

    if(JoinUtils.checkCartesianJoin(relNode, new ArrayList<Integer>(), new ArrayList<Integer>())) {
      throw new UnsupportedRelOperatorException("This query cannot be planned possibly due to either a cartesian join or an inequality join");
    } else {
      throw ex;
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:39,代码来源:DefaultSqlHandler.java

示例2: convertToDrel

import org.apache.calcite.plan.RelOptPlanner; //导入方法依赖的package包/类
/**
 *  Given a relNode tree for SELECT statement, convert to Dremio Logical RelNode tree.
 * @param relNode
 * @return
 * @throws SqlUnsupportedException
 * @throws RelConversionException
 */
public static Rel convertToDrel(SqlHandlerConfig config, final RelNode relNode) throws SqlUnsupportedException, RelConversionException {

  try {
    final RelNode convertedRelNode;

    final RelTraitSet logicalTraits = relNode.getTraitSet().plus(Rel.LOGICAL);

    final RelNode intermediateNode = transform(config, PlannerType.VOLCANO, PlannerPhase.LOGICAL, relNode, logicalTraits, true);

    // Do Join Planning.
    convertedRelNode = transform(config, PlannerType.HEP_BOTTOM_UP, PlannerPhase.JOIN_PLANNING, intermediateNode, intermediateNode.getTraitSet(), true);

    FlattenRelFinder flattenFinder = new FlattenRelFinder();
    final RelNode flattendPushed;
    if (flattenFinder.run(convertedRelNode)) {
      flattendPushed = transform(config, PlannerType.VOLCANO, PlannerPhase.FLATTEN_PUSHDOWN, convertedRelNode, convertedRelNode.getTraitSet(), true);
    } else {
      flattendPushed = convertedRelNode;
    }

    final Rel drel = (Rel) flattendPushed;

    if (drel instanceof TableModify) {
      throw new UnsupportedOperationException("TableModify " + drel);
    } else {
      final Optional<SubstitutionInfo> acceleration = findUsedMaterializations(config, drel);
      if (acceleration.isPresent()) {
        config.getObserver().planAccelerated(acceleration.get());
      }
      return drel;
    }
  } catch (RelOptPlanner.CannotPlanException ex) {
    logger.error(ex.getMessage(), ex);

    if(JoinUtils.checkCartesianJoin(relNode, Lists.<Integer>newArrayList(), Lists.<Integer>newArrayList(), Lists.<Boolean>newArrayList())) {
      throw new UnsupportedRelOperatorException("This query cannot be planned possibly due to either a cartesian join or an inequality join");
    } else {
      throw ex;
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:49,代码来源:PrelTransformer.java


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