当前位置: 首页>>代码示例>>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;未经允许,请勿转载。