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


Java Pair.getValue方法代码示例

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


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

示例1: getPlan

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
@Override
public PhysicalPlan getPlan(SqlHandlerConfig config, String sql, SqlNode sqlNode) throws Exception {
  try{
    final ConvertedRelNode convertedRelNode = PrelTransformer.validateAndConvert(config, sqlNode);
    final RelDataType validatedRowType = convertedRelNode.getValidatedRowType();
    final RelNode queryRelNode = convertedRelNode.getConvertedNode();

    final Rel drel = PrelTransformer.convertToDrel(config, queryRelNode, validatedRowType);

    final Pair<Prel, String> convertToPrel = PrelTransformer.convertToPrel(config, drel);
    final Prel prel = convertToPrel.getKey();
    textPlan = convertToPrel.getValue();
    final PhysicalOperator pop = PrelTransformer.convertToPop(config, prel);
    final PhysicalPlan plan = PrelTransformer.convertToPlan(config, pop);
    logger.debug("Final Physical Plan {}", textPlan);
    PrelTransformer.log(config, "Dremio Plan", plan, logger);


    return plan;
  }catch(Exception ex){
    throw SqlExceptionHelper.coerceException(logger, sql, ex, true);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:NormalHandler.java

示例2: isSimpleColumnSelection

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public static boolean isSimpleColumnSelection(Project project) {
  HashSet<Integer> inputRefReferenced = new HashSet<>();
  for (Pair<RexNode, String> proj : project.getNamedProjects()) {
    if (proj.getKey().getKind() != SqlKind.INPUT_REF) {
      return false;
    }
    RexInputRef inputRef = (RexInputRef) proj.getKey();
    // If the input reference is again referenced, then it is not a simple column selection (since it is not a permutation).
    if (inputRefReferenced.contains(inputRef.getIndex())) {
      return false;
    }
    final String nameOfProjectField = proj.getValue();
    final String nameOfInput = project.getInput().getRowType().getFieldNames().get(inputRef.getIndex());
    // Renaming a column is not a simple column selection
    if (nameOfProjectField == null || !nameOfProjectField.equals(nameOfInput)) {
      return false;
    }
    inputRefReferenced.add(inputRef.getIndex());
  }
  return true;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:22,代码来源:MoreRelOptUtil.java

示例3: of

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
public static DataContext of(RelDataType rowType,
    List<Pair<RexInputRef, RexNode>> usageList) {
  final int size = rowType.getFieldList().size();
  final Object[] values = new Object[size];
  for (Pair<RexInputRef, RexNode> elem : usageList) {
    Pair<Integer, ?> value = getValue(elem.getKey(), elem.getValue());
    if (value == null) {
      LOGGER.warn("{} is not handled for {} for checking implication",
          elem.getKey(), elem.getValue());
      return null;
    }
    int index = value.getKey();
    values[index] = value.getValue();
  }
  return new VisitorDataContext(values);
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:VisitorDataContext.java

示例4: getPlan

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
@Override
public PhysicalPlan getPlan(SqlHandlerConfig config, String sql, SqlNode sqlNode) throws Exception {
  try{
    SqlCreateTable sqlCreateTable = SqlNodeUtil.unwrap(sqlNode, SqlCreateTable.class);

    // TODO: fix parser to disallow this
    if (sqlCreateTable.isSingleWriter() && !sqlCreateTable.getPartitionColumns().isEmpty()) {
      throw UserException.unsupportedError()
          .message("Cannot partition data and write to a single file at the same time.")
          .build(logger);
    }

    final String newTblName = sqlCreateTable.getName();

    final ConvertedRelNode convertedRelNode = PrelTransformer.validateAndConvert(config, sqlCreateTable.getQuery());
    final RelDataType validatedRowType = convertedRelNode.getValidatedRowType();
    final RelNode queryRelNode = convertedRelNode.getConvertedNode();

    final RelNode newTblRelNode =
        SqlHandlerUtil.resolveNewTableRel(false, sqlCreateTable.getFieldNames(), validatedRowType, queryRelNode);

    final AbstractSchema schemaInstance =
        SchemaUtilities.resolveToMutableSchemaInstance(config.getConverter().getDefaultSchema(), sqlCreateTable.getSchemaPath(), systemUser, MutationType.TABLE);
    final String schemaPath = schemaInstance.getFullSchemaName();

    if (SqlHandlerUtil.getTableFromSchema(schemaInstance, newTblName) != null) {
      throw UserException.validationError()
          .message("A table or view with given name [%s] already exists in schema [%s]", newTblName, schemaPath)
          .build(logger);
    }

    final long ringCount = config.getContext().getOptions().getOption(PlannerSettings.RING_COUNT);

    final RelNode newTblRelNodeWithPCol = SqlHandlerUtil.qualifyPartitionCol(newTblRelNode, sqlCreateTable.getPartitionColumns());

    PrelTransformer.log("Calcite", newTblRelNodeWithPCol, logger, null);

    final WriterOptions options = new WriterOptions(
        (int) ringCount,
        sqlCreateTable.getPartitionColumns(),
        sqlCreateTable.getSortColumns(),
        sqlCreateTable.getDistributionColumns(),
        sqlCreateTable.getPartitionDistributionStrategy(),
        sqlCreateTable.isSingleWriter());

    // Convert the query to Dremio Logical plan and insert a writer operator on top.
    Rel drel = convertToDrel(
        config,
        newTblRelNodeWithPCol,
        schemaInstance,
        newTblName,
        options,
        newTblRelNode.getRowType(),
        createStorageOptionsMap(config, sqlCreateTable.getFormatOptions()));

    final Pair<Prel, String> convertToPrel = PrelTransformer.convertToPrel(config, drel);
    final Prel prel = convertToPrel.getKey();
    textPlan = convertToPrel.getValue();
    PhysicalOperator pop = PrelTransformer.convertToPop(config, prel);
    PhysicalPlan plan = PrelTransformer.convertToPlan(config, pop);
    PrelTransformer.log(config, "Dremio Plan", plan, logger);

    return plan;

  }catch(Exception ex){
    throw SqlExceptionHelper.coerceException(logger, sql, ex, true);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:69,代码来源:CreateTableHandler.java

示例5: toResult

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
@Override
  public List<Explain> toResult(String sql, SqlNode sqlNode) throws Exception {
    try {
      final SqlExplain node = SqlNodeUtil.unwrap(sqlNode, SqlExplain.class);
      final SqlLiteral op = node.operand(2);
      final SqlExplain.Depth depth = (SqlExplain.Depth) op.getValue();

      final ResultMode mode;
      SqlExplainLevel level = SqlExplainLevel.ALL_ATTRIBUTES;

      if (node.getDetailLevel() != null) {
        level = node.getDetailLevel();
      }

      switch (depth) {
      case LOGICAL:
        mode = ResultMode.LOGICAL;
        break;
      case PHYSICAL:
        mode = ResultMode.PHYSICAL;
        break;
      default:
        throw new UnsupportedOperationException("Unknown depth " + depth);
      }

      final SqlNode innerNode = node.operand(0);

//      try(DisabledBlock block = toggle.openDisabledBlock()){
        Rel drel;
        final ConvertedRelNode convertedRelNode = PrelTransformer.validateAndConvert(config, innerNode);
        final RelDataType validatedRowType = convertedRelNode.getValidatedRowType();
        final RelNode queryRelNode = convertedRelNode.getConvertedNode();

        PrelTransformer.log("Calcite", queryRelNode, logger, null);
        drel = PrelTransformer.convertToDrel(config, queryRelNode, validatedRowType);

        if (mode == ResultMode.LOGICAL) {
          return Collections.singletonList(new Explain(RelOptUtil.toString(drel, level)));
        }

        final Pair<Prel, String> convertToPrel = PrelTransformer.convertToPrel(config, drel);
        final String text = convertToPrel.getValue();
        return Collections.singletonList(new Explain(text));
//      }
    } catch (Exception ex){
      throw SqlExceptionHelper.coerceException(logger, sql, ex, true);
    }
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:49,代码来源:ExplainHandler.java

示例6: getScrollAndTotalSizeThenSeekToHits

import org.apache.calcite.util.Pair; //导入方法依赖的package包/类
@Override
public Pair<String, Long> getScrollAndTotalSizeThenSeekToHits() throws IOException {
  Pair<String, Long> scrollIdAndRecordCount = super.getScrollAndTotalSizeThenSeekToHits();
  recordCount = scrollIdAndRecordCount.getValue();
  return scrollIdAndRecordCount;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:CountingElasticsearchJsonReader.java


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