• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RexNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildColumnRowType

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
private ColumnRowType buildColumnRowType() {
    List<TblColRef> columns = new ArrayList<TblColRef>();
    List<Set<TblColRef>> sourceColumns = new ArrayList<Set<TblColRef>>();
    OLAPRel olapChild = (OLAPRel) getChild();
    ColumnRowType inputColumnRowType = olapChild.getColumnRowType();
    for (int i = 0; i < this.rewriteProjects.size(); i++) {
        RexNode rex = this.rewriteProjects.get(i);
        RelDataTypeField columnField = this.rowType.getFieldList().get(i);
        String fieldName = columnField.getName();
        Set<TblColRef> sourceCollector = new HashSet<TblColRef>();
        TblColRef column = translateRexNode(rex, inputColumnRowType, fieldName, sourceCollector);
        columns.add(column);
        sourceColumns.add(sourceCollector);
    }
    return new ColumnRowType(columns, sourceColumns);
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:17,代码来源:OLAPProjectRel.java


示例2: translateRexNode

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
private TblColRef translateRexNode(RexNode rexNode, ColumnRowType inputColumnRowType, String fieldName, Set<TblColRef> sourceCollector) {
    TblColRef column = null;
    if (rexNode instanceof RexInputRef) {
        RexInputRef inputRef = (RexInputRef) rexNode;
        column = translateRexInputRef(inputRef, inputColumnRowType, fieldName, sourceCollector);
    } else if (rexNode instanceof RexLiteral) {
        RexLiteral literal = (RexLiteral) rexNode;
        column = translateRexLiteral(literal);
    } else if (rexNode instanceof RexCall) {
        RexCall call = (RexCall) rexNode;
        column = translateRexCall(call, inputColumnRowType, fieldName, sourceCollector);
    } else {
        throw new IllegalStateException("Unsupport RexNode " + rexNode);
    }
    return column;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:17,代码来源:OLAPProjectRel.java


示例3: translateJoinColumn

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
private void translateJoinColumn(RexCall condition, Map<TblColRef, TblColRef> joinColumns) {
    SqlKind kind = condition.getOperator().getKind();
    if (kind == SqlKind.AND) {
        for (RexNode operand : condition.getOperands()) {
            RexCall subCond = (RexCall) operand;
            translateJoinColumn(subCond, joinColumns);
        }
    } else if (kind == SqlKind.EQUALS) {
        List<RexNode> operands = condition.getOperands();
        RexInputRef op0 = (RexInputRef) operands.get(0);
        TblColRef col0 = columnRowType.getColumnByIndex(op0.getIndex());
        RexInputRef op1 = (RexInputRef) operands.get(1);
        TblColRef col1 = columnRowType.getColumnByIndex(op1.getIndex());
        joinColumns.put(col0, col1);
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:17,代码来源:OLAPJoinRel.java


示例4: getExprVarsFromRexCall

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public static void getExprVarsFromRexCall(RexNode cond, List<ExprVar> result) {
	if(cond instanceof RexCall) {
		RexCall call = (RexCall) cond;
		for(int i = 0; i < call.getOperands().size(); i++) {
			getExprVarsFromRexCall(call.getOperands().get(i), result);
		}
		return;
	}
	// assignable variable
	if(cond instanceof RexInputRef) {
		RexInputRef ref = (RexInputRef) cond;
		for (ExprVar expr : result) {
			if(expr.varName.equals(ref.getName())) {
				// variable already created;
				return;
			}
		}
		ExprVar e = new ExprVar();
		e.varName = ref.getName();
		e.positionInRecord = ref.getIndex();
		e.type = getTypeClass(ref.getType());
		result.add(e);
		return;
	}
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:26,代码来源:StratosphereRelUtils.java


示例5: getStratosphereOperator

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
@Override
public Operator getStratosphereOperator() {
	Operator inputOp = StratosphereRelUtils.openSingleInputOperator(getInputs());
	final RexNode cond = getCondition();

	Filter f = new Filter();
	f.setCondition(cond);
	f.setRexBuilder(getCluster().getRexBuilder());
	f.prepareShipping(getInput(0).getRowType());

       //final RexExecutorImpl executor = new RexExecutorImpl(null);


	Operator filter = MapOperator.builder(new StratosphereSqlFilterMapOperator(f) )
								.input(inputOp)
								.name(condition.toString())
								.build();
	return filter;
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:20,代码来源:StratosphereSqlFilter.java


示例6: prepareShipping

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
/**
 * Create the list of fields.
 * @param rowType
 */
public void prepareShipping(RelDataType rowType) {
	Preconditions.checkNotNull(condition);
	Preconditions.checkNotNull(rexBuilder);

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

	final ImmutableList<RexNode> localExps = ImmutableList.of(condition);

	fields = new HashSet<StratosphereRexUtils.ProjectionFieldProperties>();
	int pos = 0;
	for(Pair<Integer, RelDataType> rexInput : replaceInputRefsByExternalInputRefsVisitor.getInputPosAndType() ) {
		StratosphereRexUtils.ProjectionFieldProperties field = new StratosphereRexUtils.ProjectionFieldProperties();
		field.fieldIndex = pos++;
		field.positionInInput = rexInput.getKey();
		field.inFieldType = StratosphereRelUtils.getTypeClass(rexInput.getValue());
		field.name = condition.toString();
		fields.add(field);
	}
	final RexExecutorImpl executor = new RexExecutorImpl(null);
	RexExecutable executable = executor.getExecutable(rexBuilder, localExps, rowType);
	System.err.println("Code: "+executable.getSource());
	this.source = executable.getSource();
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:29,代码来源:Filter.java


示例7: getProjectFields

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
private int[] getProjectFields(List<RexNode> exps) {
    final int[] fields = new int[exps.size()];
    for (int i = 0; i < exps.size(); i++) {
        final RexNode exp = exps.get(i);
        if (exp instanceof RexInputRef) {
            fields[i] = ((RexInputRef) exp).getIndex();
        } else {
            return null; // not a simple projection
        }
    }
    return fields;
}
 
开发者ID:OSBI,项目名称:optiq-solr,代码行数:13,代码来源:SolrPushProjectOntoTableRule.java


示例8: getProjectFields

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
private int[] getProjectFields(List<RexNode> exps) {
  final int[] fields = new int[exps.size()];
  for (int i = 0; i < exps.size(); i++) {
    final RexNode exp = exps.get(i);
    if (exp instanceof RexInputRef) {
      fields[i] = ((RexInputRef) exp).getIndex();
    } else {
      return null; // not a simple projection
    }
  }
  return fields;
}
 
开发者ID:apache,项目名称:incubator-optiq-csv,代码行数:13,代码来源:CsvPushProjectOntoTableRule.java


示例9: OLAPProjectRel

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public OLAPProjectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, List<RexNode> exps, RelDataType rowType, int flags) {
    super(cluster, traitSet, child, exps, rowType, flags);
    Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
    Preconditions.checkArgument(child.getConvention() == OLAPRel.CONVENTION);
    this.rewriteProjects = exps;
    this.hasJoin = false;
    this.afterJoin = false;
    this.rowType = getRowType();
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:10,代码来源:OLAPProjectRel.java


示例10: OLAPLimitRel

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public OLAPLimitRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RexNode offset, RexNode fetch) {
    super(cluster, traitSet, child);
    Preconditions.checkArgument(getConvention() == CONVENTION);
    Preconditions.checkArgument(getConvention() == child.getConvention());
    this.localOffset = offset;
    this.localFetch = fetch;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:8,代码来源:OLAPLimitRel.java


示例11: OLAPJoinRel

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public OLAPJoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, //
        RexNode condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys, //
        JoinRelType joinType, Set<String> variablesStopped) throws InvalidRelException {
    super(cluster, traits, left, right, condition, leftKeys, rightKeys, joinType, variablesStopped);
    Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
    this.rowType = getRowType();
    this.isTopJoin = false;
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:9,代码来源:OLAPJoinRel.java


示例12: copy

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
@Override
public EnumerableJoinRel copy(RelTraitSet traitSet, RexNode conditionExpr, RelNode left, RelNode right, //
        JoinRelType joinType, boolean semiJoinDone) {

    final JoinInfo joinInfo = JoinInfo.of(left, right, condition);
    assert joinInfo.isEqui();
    try {
        return new OLAPJoinRel(getCluster(), traitSet, left, right, condition, joinInfo.leftKeys, joinInfo.rightKeys, joinType, variablesStopped);
    } catch (InvalidRelException e) {
        // Semantic error not possible. Must be a bug. Convert to
        // internal error.
        throw new AssertionError(e);
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:15,代码来源:OLAPJoinRel.java


示例13: getFields

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public Class<? extends Value>[] getFields() {
	Class<? extends Value>[] fields = new Class[this.exps.size()];
	Iterator<RexNode> it = exps.iterator();
	int i = 0;
	while(it.hasNext()) {
		RexInputRef inputRef = (RexInputRef) it.next();
		fields[i++] = StratosphereRelUtils.getTypeClass(inputRef.getType());
	}
	return fields;
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:11,代码来源:StratosphereSqlProjection.java


示例14: convertRexCallToJexlExpr

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public static String convertRexCallToJexlExpr(RexNode c) {
	StringBuffer sb = new StringBuffer();
	if(c instanceof RexCall) {
		RexCall call = (RexCall) c;
		sb.append("(");
		for(int i = 0; i < call.getOperands().size(); i++) {
			sb.append( convertRexCallToJexlExpr(call.getOperands().get(i)));
			if(i+1 <call.getOperands().size()) {
				switch(c.getKind()) {
					case AND:
						sb.append(" && ");
						break;
					case OR:
						sb.append(" || ");
						break;
					case EQUALS:
						sb.append(" == ");
						break;
					case LESS_THAN:
						sb.append(" < ");
						break;
					default:
						throw new RuntimeException("Unknown kind "+c.getKind());
				}
			}
		}
		sb.append(")");
	}
	// assignable variable
	if(c instanceof RexInputRef) {
		RexInputRef ref = (RexInputRef) c;
		return ref.getName();
	}
	if(c instanceof RexLiteral) {
		RexLiteral lit = (RexLiteral) c;
		return lit.getValue().toString();
	}
	return sb.toString();
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:40,代码来源:StratosphereRelUtils.java


示例15: StratosphereSqlJoin

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public StratosphereSqlJoin(RelOptCluster cluster, RelTraitSet traits,
		RelNode left, RelNode right, RexNode condition,
		JoinRelType joinType, Set<String> variablesStopped) {
	super(cluster, traits, left, right, condition, joinType, variablesStopped);

	Preconditions.checkArgument(getConvention() == CONVENTION);
	Preconditions.checkArgument(joinType == JoinRelType.INNER, "Only inner joins are supported at the moment");
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:9,代码来源:StratosphereSqlJoin.java


示例16: copy

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
@Override
public JoinRelBase copy(RelTraitSet traitSet, RexNode conditionExpr,
		RelNode left, RelNode right, JoinRelType joinType) {
	System.err.println("StratoJoin.copy()");
	return new StratosphereSqlJoin(getCluster(), traitSet, left,
			right, conditionExpr, joinType, getVariablesStopped());
}
 
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:8,代码来源:StratosphereSqlJoin.java


示例17: EnumerableSort

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public EnumerableSort(RelOptCluster cluster, RelTraitSet traits, RelNode input, RexNode offset, RexNode fetch, DataTable<?> accumuloAccessor) {
  super(cluster, traits, input);

  this.offset = offset;
  this.fetch = fetch;
  this.accumuloAccessor = accumuloAccessor;
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:8,代码来源:EnumerableSort.java


示例18: apply

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
@Override
public String apply(RexNode exp) {

  if (exp instanceof RexInputRef) {
    return ((RexInputRef) exp).getName();
  } else
    return exp.toString();
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:9,代码来源:ReferenceNodetoString.java


示例19: 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


示例20: OLAPFilterRel

import org.eigenbase.rex.RexNode; //导入依赖的package包/类
public OLAPFilterRel(RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) {
    super(cluster, traits, child, condition);
    Preconditions.checkArgument(getConvention() == CONVENTION);
    Preconditions.checkArgument(getConvention() == child.getConvention());
    this.rowType = getRowType();
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:7,代码来源:OLAPFilterRel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RelationPredicate类代码示例发布时间:2022-05-22
下一篇:
Java Blob类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap