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


Java TupleSerializerBase类代码示例

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


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

示例1: configure

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
private void configure(String lineDelimiter, String fieldDelimiter,
		TupleTypeInfoBase<OUT> tupleTypeInfo, boolean[] includedFieldsMask) {

	if (tupleTypeInfo.getArity() == 0) {
		throw new IllegalArgumentException("Tuple size must be greater than 0.");
	}

	if (includedFieldsMask == null) {
		includedFieldsMask = createDefaultMask(tupleTypeInfo.getArity());
	}

	tupleSerializer = (TupleSerializerBase<OUT>) tupleTypeInfo.createSerializer(new ExecutionConfig());

	setDelimiter(lineDelimiter);
	setFieldDelimiter(fieldDelimiter);

	Class<?>[] classes = new Class<?>[tupleTypeInfo.getArity()];

	for (int i = 0; i < tupleTypeInfo.getArity(); i++) {
		classes[i] = tupleTypeInfo.getTypeAt(i).getTypeClass();
	}

	setFieldsGeneric(includedFieldsMask, classes);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:TupleCsvInputFormat.java

示例2: RecursiveProductFieldAccessor

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
RecursiveProductFieldAccessor(int pos, TypeInformation<T> typeInfo, FieldAccessor<R, F> innerAccessor, ExecutionConfig config) {
	int arity = ((TupleTypeInfoBase) typeInfo).getArity();
	if (pos < 0 || pos >= arity) {
		throw new CompositeType.InvalidFieldReferenceException(
			"Tried to select " + ((Integer) pos).toString() + ". field on \"" +
				typeInfo.toString() + "\", which is an invalid index.");
	}
	checkNotNull(typeInfo, "typeInfo must not be null.");
	checkNotNull(innerAccessor, "innerAccessor must not be null.");

	this.pos = pos;
	this.fieldType = ((TupleTypeInfoBase<T>) typeInfo).getTypeAt(pos);
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(config);
	this.length = this.serializer.getArity();
	this.fields = new Object[this.length];
	this.innerAccessor = innerAccessor;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:FieldAccessor.java

示例3: open

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
@Override
public void open(FileInputSplit split) throws IOException {
	super.open(split);
	
	@SuppressWarnings("unchecked")
	FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers();
	
	//throw exception if no field parsers are available
	if (fieldParsers.length == 0) {
		throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input");
	}
	
	// create the value holders
	this.parsedValues = new Object[fieldParsers.length];
	for (int i = 0; i < fieldParsers.length; i++) {
		this.parsedValues[i] = fieldParsers[i].createValue();
	}
	
	// left to right evaluation makes access [0] okay
	// this marker is used to fasten up readRecord, so that it doesn't have to check each call if the line ending is set to default
	if (this.getDelimiter().length == 1 && this.getDelimiter()[0] == '\n' ) {
		this.lineDelimiterIsLinebreak = true;
	}

	serializer = (TupleSerializerBase<OUT>)serializerFactory.getSerializer();
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:27,代码来源:ScalaCsvInputFormat.java

示例4: open

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
@Override
public void open(Configuration parameters) throws Exception {
	for (AggregationFunction<Object> aggFunction : aggFunctions) {
		aggFunction.initializeAggregate();
	}
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(getRuntimeContext().getExecutionConfig());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:ScalaAggregateOperator.java

示例5: SimpleProductFieldAccessor

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
SimpleProductFieldAccessor(int pos, TypeInformation<T> typeInfo, ExecutionConfig config) {
	checkNotNull(typeInfo, "typeInfo must not be null.");
	int arity = ((TupleTypeInfoBase) typeInfo).getArity();
	if (pos < 0 || pos >= arity) {
		throw new CompositeType.InvalidFieldReferenceException(
			"Tried to select " + ((Integer) pos).toString() + ". field on \"" +
				typeInfo.toString() + "\", which is an invalid index.");
	}

	this.pos = pos;
	this.fieldType = ((TupleTypeInfoBase<T>) typeInfo).getTypeAt(pos);
	this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(config);
	this.length = this.serializer.getArity();
	this.fields = new Object[this.length];
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:16,代码来源:FieldAccessor.java

示例6: ProductFieldAccessor

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
ProductFieldAccessor(int pos, TypeInformation<R> typeInfo, ExecutionConfig config) {
	this.pos = pos;
	this.fieldType = ((TupleTypeInfoBase<R>)typeInfo).getTypeAt(pos);
	this.serializer = (TupleSerializerBase<R>)typeInfo.createSerializer(config);
	this.length = this.serializer.getArity();
	this.fields = new Object[this.length];
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FieldAccessor.java

示例7: AggregatingUdf

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
public AggregatingUdf(TypeSerializerFactory<T> serializerFactory, AggregationFunction<Object>[] aggFunctions, int[] fieldPositions) {
	Validate.notNull(serializerFactory);
	Validate.notNull(aggFunctions);
	Validate.isTrue(aggFunctions.length == fieldPositions.length);
	Validate.isTrue(serializerFactory.getSerializer() instanceof TupleSerializerBase);

	this.serializerFactory = serializerFactory;
	this.aggFunctions = aggFunctions;
	this.fieldPositions = fieldPositions;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:11,代码来源:ScalaAggregateOperator.java

示例8: open

import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase; //导入依赖的package包/类
@Override
public void open(Configuration parameters) throws Exception {
	for (int i = 0; i < aggFunctions.length; i++) {
		aggFunctions[i].initializeAggregate();
	}
	serializer = (TupleSerializerBase<T>)serializerFactory.getSerializer();
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:8,代码来源:ScalaAggregateOperator.java


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