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


Java RexNode类代码示例

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


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


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