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


Java RexNode.accept方法代码示例

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


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

示例1: visitCall

import org.eigenbase.rex.RexNode; //导入方法依赖的package包/类
@Override
public ChildVisitor visitCall(RexCall call) {
  final SqlSyntax syntax = call.getOperator().getSyntax();
  switch (syntax) {
    case Binary:
      return visitBinary(call);
    case Function:
      buf.append(call.getOperator().getName().toLowerCase()).append("(");
      for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
        buf.append(operand.i > 0 ? ", " : "");
        operand.e.accept(this);
      }
      return null;
    case Special:
      switch (call.getKind()) {
        case Cast:
          // Ignore casts. Drill is type-less.
          return call.getOperands().get(0).accept(this);
        default:
          break;
      }
      if (call.getOperator() == SqlStdOperatorTable.itemOp) {
        final RexNode left = call.getOperands().get(0);
        final int length = buf.length();
        left.accept(this);
        if (buf.length() > length) {
          // check before generating empty LHS if inputName is null
          buf.append('.');
        }
        // return buf.append(field);
        return null;
      }
      // fall through
    default:
      throw new AssertionError("todo: implement syntax " + syntax + "(" + call + ")");
  }
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:38,代码来源:OperationVisitor.java

示例2: getStratosphereOperator

import org.eigenbase.rex.RexNode; //导入方法依赖的package包/类
@Override
public Operator getStratosphereOperator() {
	System.err.println("Preparing operator "+this.getDigest());

	// get Input
	Operator inputOp = StratosphereRelUtils.openSingleInputOperator(getInputs());
	System.err.println("Input is "+inputOp);

	final RexBuilder rexBuilder = getCluster().getRexBuilder();
	final RexExecutorImpl executor = new RexExecutorImpl(null);

	final List<RexNode> complexExps = new ArrayList<RexNode>();


	StratosphereRexUtils.GetInputRefVisitor replaceInputRefsByExternalInputRefsVisitor = new StratosphereRexUtils.GetInputRefVisitor();

	Set<StratosphereRexUtils.ProjectionFieldProperties> fields = new HashSet<StratosphereRexUtils.ProjectionFieldProperties>();
	int pos = 0;
	int rexpos = 0;
	for(RexNode rex : exps) {
		if(rex.getKind() != SqlKind.INPUT_REF) {
			complexExps.add(rex);
		}
		rex.accept(replaceInputRefsByExternalInputRefsVisitor);
		boolean trivialProjection = rex.getKind() == SqlKind.INPUT_REF;
		for(Pair<Integer, RelDataType> rexInput : replaceInputRefsByExternalInputRefsVisitor.getInputPosAndType() ) {
			StratosphereRexUtils.ProjectionFieldProperties field = new StratosphereRexUtils.ProjectionFieldProperties();
			field.positionInOutput = pos;
			field.fieldIndex = pos;
			field.positionInRex = rexpos;
			field.positionInInput = rexInput.getKey();
			field.inFieldType = StratosphereRelUtils.getTypeClass(rexInput.getValue());
			field.outFieldType = StratosphereRelUtils.getTypeClass( getRowType().getFieldList().get(pos).getType() );
			field.trivialProjection = trivialProjection;
			if(fields.add(field)) {
				System.err.println("adding projection field="+field+" for rex="+rex);
			} else {
				System.err.println("fields already contained "+field+" for rex="+rex);
			}
			field.name = rex.toString();
		}
		pos++;
		if(!trivialProjection) {
			rexpos++;
		}
		replaceInputRefsByExternalInputRefsVisitor.resetInputList();
	}

	RexExecutable executable = executor.getExecutable(rexBuilder, complexExps, getInput(0).getRowType() );
	System.err.println("Code="+executable.getSource());
	// create MapOperator
	MapOperator proj = MapOperator	.builder(new StratosphereSqlProjectionMapOperator(executable.getFunction(),
																					fields, executable.getSource()))
									.input(inputOp)
									.name(buildName())
									.build();
	return proj;
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:59,代码来源:StratosphereSqlProjection.java

示例3: implement

import org.eigenbase.rex.RexNode; //导入方法依赖的package包/类
@Override
public int implement(Plan implementor) {
  
  implementor.visitChild(getChild());
  
  implementor.table = accumuloAccessor;
  
  OperationVisitor visitor = new OperationVisitor(getChild());
  
  cosmos.sql.call.impl.Projection projections = new cosmos.sql.call.impl.Projection();
  for (RexNode node : exps) {
    CallIfc<?> projection = node.accept(visitor);
    projections.addChild(projection.getClass().getSimpleName(), projection);
    
  }
  implementor.add(projections.getClass().getSimpleName(), projections);
  
  return 1;
  
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:21,代码来源:Projection.java


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