本文整理汇总了Java中org.eigenbase.util.Pair类的典型用法代码示例。如果您正苦于以下问题:Java Pair类的具体用法?Java Pair怎么用?Java Pair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pair类属于org.eigenbase.util包,在下文中一共展示了Pair类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: prepareShipping
import org.eigenbase.util.Pair; //导入依赖的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
示例2: getRowType
import org.eigenbase.util.Pair; //导入依赖的package包/类
public RelDataType getRowType(JavaTypeFactory typeFactory) {
initialize();
List<String> names = new ArrayList<String>();
List<RelDataType> types = new ArrayList<RelDataType>();
// iterate through FieldDefs, populating names and types
for (FieldDef f : this.fields) {
names.add(f.getName());
WebFieldType fieldType = f.getType();
RelDataType type;
if (fieldType == null) {
type = typeFactory.createJavaType(String.class);
} else {
type = fieldType.toType(typeFactory);
}
types.add(type);
}
if (names.isEmpty()) {
names.add("line");
types.add(typeFactory.createJavaType(String.class));
}
return typeFactory.createStructType(Pair.zip(names, types));
}
开发者ID:HenryOlson,项目名称:optiq-web,代码行数:29,代码来源:WebRowConverter.java
示例3: visitInputRef
import org.eigenbase.util.Pair; //导入依赖的package包/类
public Void visitInputRef(RexInputRef inputRef) {
// if (true) { // do I need a condition here?
// inputRef.setExternalRef(true);
// }
// System.err.println("Setting input ref " + inputRef + " index "
// + inputRef.getIndex());
inputPosAndType
.add(Pair.of(inputRef.getIndex(), inputRef.getType()));
return null;
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:11,代码来源:StratosphereRexUtils.java
示例4: load
import org.eigenbase.util.Pair; //导入依赖的package包/类
@Override
public LoadingCache<IClass, Pair<RelDataType, List<Function<Integer, Object>>>> load(
final RelDataTypeFactory typeFactory) throws Exception {
return CacheBuilder.newBuilder().weakKeys()
.build(new ClassRowTypeResolver(typeFactory));
}
开发者ID:vlsi,项目名称:optiq-mat-plugin,代码行数:7,代码来源:ClassRowTypeCache.java
示例5: getInputPosAndType
import org.eigenbase.util.Pair; //导入依赖的package包/类
public List<Pair<Integer, RelDataType>> getInputPosAndType() {
return inputPosAndType;
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:4,代码来源:StratosphereRexUtils.java
示例6: getStratosphereOperator
import org.eigenbase.util.Pair; //导入依赖的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
示例7: parseRowType
import org.eigenbase.util.Pair; //导入依赖的package包/类
private void parseRowType(RelDataTypeFactory typeFactory) {
// parse fields
List<Entry<String, RelDataType>> optiqFields = new ArrayList<Entry<String,RelDataType>>();
Schema schema = getSchema();
for (Schema.Field field : schema.getFields() ) {
Schema.Type type = field.schema().getType();
Map.Entry<String, RelDataType> mapPair = null;
switch (type) {
case INT :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.INTEGER));
break;
case BOOLEAN :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.BOOLEAN));
break;
case BYTES :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.TINYINT));
break;
case DOUBLE :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.DOUBLE));
break;
case FLOAT :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.FLOAT));
break;
case LONG :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.BIGINT));
break;
case NULL :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.NULL));
break;
case RECORD :
case STRING :
mapPair = Pair.of(field.name(),typeFactory.createSqlType(SqlTypeName.VARCHAR));
break;
case FIXED :
case UNION :
case ARRAY :
case ENUM :
case MAP :
default :
throw new RuntimeException("Complex Avro Data Types are not supported\n");
} //end switch
optiqFields.add(mapPair);
}//end for
// create row type for optiq
rowType = typeFactory.createStructType(optiqFields);
System.err.println("Created type "+rowType);
}
开发者ID:rmetzger,项目名称:stratosphere-sql,代码行数:51,代码来源:AvroStratosphereTable.java
注:本文中的org.eigenbase.util.Pair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论