當前位置: 首頁>>代碼示例>>Java>>正文


Java ProjectPrel.getChildExps方法代碼示例

本文整理匯總了Java中org.apache.drill.exec.planner.physical.ProjectPrel.getChildExps方法的典型用法代碼示例。如果您正苦於以下問題:Java ProjectPrel.getChildExps方法的具體用法?Java ProjectPrel.getChildExps怎麽用?Java ProjectPrel.getChildExps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.drill.exec.planner.physical.ProjectPrel的用法示例。


在下文中一共展示了ProjectPrel.getChildExps方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitProject

import org.apache.drill.exec.planner.physical.ProjectPrel; //導入方法依賴的package包/類
@Override
public Prel visitProject(ProjectPrel node, Object unused) throws RelConversionException {
  ProjectPrel project = node;
  List<RexNode> exprList = new ArrayList<>();
  boolean rewrite = false;

  List<RelDataTypeField> relDataTypes = new ArrayList<>();
  int i = 0;
  RexNode flatttenExpr = null;
  for (RexNode rex : project.getChildExps()) {
    RexNode newExpr = rex;
    if (rex instanceof RexCall) {
      RexCall function = (RexCall) rex;
      String functionName = function.getOperator().getName();

      if (functionName.equalsIgnoreCase("flatten") ) {
        rewrite = true;
        if (function.getOperands().size() != 1) {
          throw new RelConversionException("Flatten expression expects a single input.");
        }
        newExpr = function.getOperands().get(0);
        RexBuilder builder = new RexBuilder(factory);
        flatttenExpr = builder.makeInputRef( new RelDataTypeDrillImpl(new RelDataTypeHolder(), factory), i);
      }
    }
    relDataTypes.add(project.getRowType().getFieldList().get(i));
    i++;
    exprList.add(newExpr);
  }
  if (rewrite == true) {
    // TODO - figure out what is the right setting for the traits
    Prel newChild = ((Prel)project.getInput(0)).accept(this, null);
    ProjectPrel newProject = new ProjectPrel(node.getCluster(), project.getTraitSet(), newChild, exprList, new RelRecordType(relDataTypes));
    FlattenPrel flatten = new FlattenPrel(project.getCluster(), project.getTraitSet(), newProject, flatttenExpr);
    return flatten;
  }

  Prel child = ((Prel)project.getInput()).accept(this, null);
  return (Prel) project.copy(project.getTraitSet(), child, exprList, new RelRecordType(relDataTypes));
}
 
開發者ID:axbaretto,項目名稱:drill,代碼行數:41,代碼來源:RewriteProjectToFlatten.java

示例2: visitProject

import org.apache.drill.exec.planner.physical.ProjectPrel; //導入方法依賴的package包/類
@Override
public Prel visitProject(ProjectPrel node, Object unused) throws RelConversionException {
  ProjectPrel project = node;
  List<RexNode> exprList = new ArrayList<>();
  boolean rewrite = false;

  List<RelDataTypeField> relDataTypes = new ArrayList();
  int i = 0;
  RexNode flatttenExpr = null;
  for (RexNode rex : project.getChildExps()) {
    RexNode newExpr = rex;
    if (rex instanceof RexCall) {
      RexCall function = (RexCall) rex;
      String functionName = function.getOperator().getName();
      int nArgs = function.getOperands().size();

      if (functionName.equalsIgnoreCase("flatten") ) {
        rewrite = true;
        if (function.getOperands().size() != 1) {
          throw new RelConversionException("Flatten expression expects a single input.");
        }
        newExpr = function.getOperands().get(0);
        RexBuilder builder = new RexBuilder(factory);
        flatttenExpr = builder.makeInputRef( new RelDataTypeDrillImpl(new RelDataTypeHolder(), factory), i);
      }
    }
    relDataTypes.add(project.getRowType().getFieldList().get(i));
    i++;
    exprList.add(newExpr);
  }
  if (rewrite == true) {
    // TODO - figure out what is the right setting for the traits
    Prel newChild = ((Prel)project.getInput(0)).accept(this, null);
    ProjectPrel newProject = new ProjectPrel(node.getCluster(), project.getTraitSet(), newChild, exprList, new RelRecordType(relDataTypes));
    FlattenPrel flatten = new FlattenPrel(project.getCluster(), project.getTraitSet(), newProject, flatttenExpr);
    return flatten;
  }

  Prel child = ((Prel)project.getInput()).accept(this, null);
  return (Prel) project.copy(project.getTraitSet(), child, exprList, new RelRecordType(relDataTypes));
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:42,代碼來源:RewriteProjectToFlatten.java


注:本文中的org.apache.drill.exec.planner.physical.ProjectPrel.getChildExps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。