Package org.apache.hadoop.hive.ql.optimizer.optiq.reloperators

Examples of org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveProjectRel$HiveProjectFactoryImpl


   * @return
   */
  public static Pair<RelNode, RelNode> getTopLevelSelect(final RelNode rootRel) {
    RelNode tmpRel = rootRel;
    RelNode parentOforiginalProjRel = rootRel;
    HiveProjectRel originalProjRel = null;

    while (tmpRel != null) {
      if (tmpRel instanceof HiveProjectRel) {
        originalProjRel = (HiveProjectRel) tmpRel;
        break;
View Full Code Here


    if ((obChild.getRowType().getFieldCount() - inputRefToCallMap.size()) != resultSchema.size()) {
      LOG.error(generateInvalidSchemaMessage(obChild, resultSchema, inputRefToCallMap.size()));
      throw new OptiqSemanticException("Result Schema didn't match Optimized Op Tree Schema");
    }
    // This removes order-by only expressions from the projections.
    HiveProjectRel replacementProjectRel = HiveProjectRel.create(obChild.getChild(), obChild
        .getChildExps().subList(0, resultSchema.size()), obChild.getRowType().getFieldNames()
        .subList(0, resultSchema.size()));
    obRel.replaceInput(0, replacementProjectRel);
    obRel.setInputRefToCallMap(inputRefToCallMap);
  }
View Full Code Here

  private static RelNode renameTopLevelSelectInResultSchema(final RelNode rootRel,
      Pair<RelNode, RelNode> topSelparentPair, List<FieldSchema> resultSchema)
      throws OptiqSemanticException {
    RelNode parentOforiginalProjRel = topSelparentPair.getKey();
    HiveProjectRel originalProjRel = (HiveProjectRel) topSelparentPair.getValue();

    // Assumption: top portion of tree could only be
    // (limit)?(OB)?(ProjectRelBase)....
    List<RexNode> rootChildExps = originalProjRel.getChildExps();
    if (resultSchema.size() != rootChildExps.size()) {
      // Safeguard against potential issues in CBO RowResolver construction. Disable CBO for now.
      LOG.error(generateInvalidSchemaMessage(originalProjRel, resultSchema, 0));
      throw new OptiqSemanticException("Result Schema didn't match Optimized Op Tree Schema");
    }

    List<String> newSelAliases = new ArrayList<String>();
    String colAlias;
    for (int i = 0; i < rootChildExps.size(); i++) {
      colAlias = resultSchema.get(i).getName();
      if (colAlias.startsWith("_")) {
        colAlias = colAlias.substring(1);
      }
      newSelAliases.add(colAlias);
    }

    HiveProjectRel replacementProjectRel = HiveProjectRel.create(originalProjRel.getChild(),
        originalProjRel.getChildExps(), newSelAliases);

    if (rootRel == originalProjRel) {
      return replacementProjectRel;
    } else {
View Full Code Here

  }

  private static RelNode introduceDerivedTable(final RelNode rel) {
    List<RexNode> projectList = HiveOptiqUtil.getProjsFromBelowAsInputRef(rel);

    HiveProjectRel select = HiveProjectRel.create(rel.getCluster(), rel, projectList,
        rel.getRowType(), rel.getCollationList());

    return select;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveProjectRel$HiveProjectFactoryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.