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

Java Tuple9类代码示例

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

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



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

示例1: testTupleWithPrimitiveArray

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
@Test
public void testTupleWithPrimitiveArray() {
	RichMapFunction<Integer, Tuple9<int[],double[],long[],byte[],char[],float[],short[], boolean[], String[]>> function = new RichMapFunction<Integer, Tuple9<int[],double[],long[],byte[],char[],float[],short[], boolean[], String[]>>() {
		private static final long serialVersionUID = 1L;

		@Override
		public Tuple9<int[], double[], long[], byte[], char[], float[], short[], boolean[], String[]> map(Integer value) throws Exception {
			return null;
		}
	};
	
	TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, BasicTypeInfo.INT_TYPE_INFO);
	TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
	Assert.assertEquals(PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(0));
	Assert.assertEquals(PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(1));
	Assert.assertEquals(PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(2));
	Assert.assertEquals(PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(3));
	Assert.assertEquals(PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(4));
	Assert.assertEquals(PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(5));
	Assert.assertEquals(PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(6));
	Assert.assertEquals(PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO, tti.getTypeAt(7));
	Assert.assertEquals(BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO, tti.getTypeAt(8));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:TypeExtractorTest.java


示例2: newTuple

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Convert object array to type of Tuple{N} where N is between 0 to 25.
 *
 * @throws IllegalArgumentException if rows's length > 25
 */
public static <T extends Tuple> T newTuple(Object[] row) {
	Preconditions.checkNotNull(row, "Tuple row is null");
	switch (row.length) {
		case 0:
			return setTupleValue(new Tuple0(), row);
		case 1:
			return setTupleValue(new Tuple1(), row);
		case 2:
			return setTupleValue(new Tuple2(), row);
		case 3:
			return setTupleValue(new Tuple3(), row);
		case 4:
			return setTupleValue(new Tuple4(), row);
		case 5:
			return setTupleValue(new Tuple5(), row);
		case 6:
			return setTupleValue(new Tuple6(), row);
		case 7:
			return setTupleValue(new Tuple7(), row);
		case 8:
			return setTupleValue(new Tuple8(), row);
		case 9:
			return setTupleValue(new Tuple9(), row);
		case 10:
			return setTupleValue(new Tuple10(), row);
		case 11:
			return setTupleValue(new Tuple11(), row);
		case 12:
			return setTupleValue(new Tuple12(), row);
		case 13:
			return setTupleValue(new Tuple13(), row);
		case 14:
			return setTupleValue(new Tuple14(), row);
		case 15:
			return setTupleValue(new Tuple15(), row);
		case 16:
			return setTupleValue(new Tuple16(), row);
		case 17:
			return setTupleValue(new Tuple17(), row);
		case 18:
			return setTupleValue(new Tuple18(), row);
		case 19:
			return setTupleValue(new Tuple19(), row);
		case 20:
			return setTupleValue(new Tuple20(), row);
		case 21:
			return setTupleValue(new Tuple21(), row);
		case 22:
			return setTupleValue(new Tuple22(), row);
		case 23:
			return setTupleValue(new Tuple23(), row);
		case 24:
			return setTupleValue(new Tuple24(), row);
		case 25:
			return setTupleValue(new Tuple25(), row);
		default:
			throw new IllegalArgumentException("Too long row: " + row.length + ", unable to convert to Tuple");
	}
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:65,代码来源:SiddhiTupleFactory.java


示例3: newTuple

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Convert object array to type of Tuple{N} where N is between 0 to 25.
 *
 * @throws IllegalArgumentException if rows's length > 25
 */
public static <T extends Tuple> T newTuple(Object[] row) {
    Preconditions.checkNotNull(row, "Tuple row is null");
    switch (row.length) {
        case 0:
            return setTupleValue(new Tuple0(), row);
        case 1:
            return setTupleValue(new Tuple1(), row);
        case 2:
            return setTupleValue(new Tuple2(), row);
        case 3:
            return setTupleValue(new Tuple3(), row);
        case 4:
            return setTupleValue(new Tuple4(), row);
        case 5:
            return setTupleValue(new Tuple5(), row);
        case 6:
            return setTupleValue(new Tuple6(), row);
        case 7:
            return setTupleValue(new Tuple7(), row);
        case 8:
            return setTupleValue(new Tuple8(), row);
        case 9:
            return setTupleValue(new Tuple9(), row);
        case 10:
            return setTupleValue(new Tuple10(), row);
        case 11:
            return setTupleValue(new Tuple11(), row);
        case 12:
            return setTupleValue(new Tuple12(), row);
        case 13:
            return setTupleValue(new Tuple13(), row);
        case 14:
            return setTupleValue(new Tuple14(), row);
        case 15:
            return setTupleValue(new Tuple15(), row);
        case 16:
            return setTupleValue(new Tuple16(), row);
        case 17:
            return setTupleValue(new Tuple17(), row);
        case 18:
            return setTupleValue(new Tuple18(), row);
        case 19:
            return setTupleValue(new Tuple19(), row);
        case 20:
            return setTupleValue(new Tuple20(), row);
        case 21:
            return setTupleValue(new Tuple21(), row);
        case 22:
            return setTupleValue(new Tuple22(), row);
        case 23:
            return setTupleValue(new Tuple23(), row);
        case 24:
            return setTupleValue(new Tuple24(), row);
        case 25:
            return setTupleValue(new Tuple25(), row);
        default:
            throw new IllegalArgumentException("Too long row: " + row.length + ", unable to convert to Tuple");
    }
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:65,代码来源:SiddhiTupleFactory.java


示例4: add

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
public Tuple9Builder<T0, T1, T2, T3, T4, T5, T6, T7, T8> add(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8){
	tuples.add(new Tuple9<>(value0, value1, value2, value3, value4, value5, value6, value7, value8));
	return this;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:Tuple9Builder.java


示例5: build

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>[] build(){
	return tuples.toArray(new Tuple9[tuples.size()]);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:Tuple9Builder.java


示例6: testTupleWithBasicTypes

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testTupleWithBasicTypes() throws Exception {
	// use getMapReturnTypes()
	RichMapFunction<?, ?> function = new RichMapFunction<Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>, Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>>() {
		private static final long serialVersionUID = 1L;

		@Override
		public Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> map(
				Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> value) throws Exception {
			return null;
		}

	};

	TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInfoParser.parse("Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>"));

	Assert.assertTrue(ti.isTupleType());
	Assert.assertEquals(9, ti.getArity());
	Assert.assertTrue(ti instanceof TupleTypeInfo);
	List<FlatFieldDescriptor> ffd = new ArrayList<FlatFieldDescriptor>();
	((TupleTypeInfo) ti).getFlatFields("f3", 0, ffd);
	Assert.assertTrue(ffd.size() == 1);
	Assert.assertEquals(3, ffd.get(0).getPosition() );

	TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
	Assert.assertEquals(Tuple9.class, tti.getTypeClass());
	
	for (int i = 0; i < 9; i++) {
		Assert.assertTrue(tti.getTypeAt(i) instanceof BasicTypeInfo);
	}

	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(1));
	Assert.assertEquals(BasicTypeInfo.DOUBLE_TYPE_INFO, tti.getTypeAt(2));
	Assert.assertEquals(BasicTypeInfo.FLOAT_TYPE_INFO, tti.getTypeAt(3));
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti.getTypeAt(4));
	Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(5));
	Assert.assertEquals(BasicTypeInfo.CHAR_TYPE_INFO, tti.getTypeAt(6));
	Assert.assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, tti.getTypeAt(7));
	Assert.assertEquals(BasicTypeInfo.BYTE_TYPE_INFO, tti.getTypeAt(8));

	// use getForObject()
	Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> t = new Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>(
			1, 1L, 1.0, 1.0F, false, "Hello World", 'w', (short) 1, (byte) 1);

	Assert.assertTrue(TypeExtractor.getForObject(t) instanceof TupleTypeInfo);
	TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) TypeExtractor.getForObject(t);

	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti2.getTypeAt(1));
	Assert.assertEquals(BasicTypeInfo.DOUBLE_TYPE_INFO, tti2.getTypeAt(2));
	Assert.assertEquals(BasicTypeInfo.FLOAT_TYPE_INFO, tti2.getTypeAt(3));
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti2.getTypeAt(4));
	Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti2.getTypeAt(5));
	Assert.assertEquals(BasicTypeInfo.CHAR_TYPE_INFO, tti2.getTypeAt(6));
	Assert.assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, tti2.getTypeAt(7));
	Assert.assertEquals(BasicTypeInfo.BYTE_TYPE_INFO, tti2.getTypeAt(8));
	
	// test that getForClass does not work
	try {
		TypeExtractor.getForClass(Tuple9.class);
		Assert.fail("Exception expected here");
	} catch (InvalidTypesException e) {
		// that is correct
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:68,代码来源:TypeExtractorTest.java


示例7: add

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
public Tuple9Builder<T0, T1, T2, T3, T4, T5, T6, T7, T8> add(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8){
	tuples.add(new Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>(value0, value1, value2, value3, value4, value5, value6, value7, value8));
	return this;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:5,代码来源:Tuple9Builder.java


示例8: testTupleWithBasicTypes

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testTupleWithBasicTypes() throws Exception {
	// use getMapReturnTypes()
	RichMapFunction<?, ?> function = new RichMapFunction<Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>, Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>>() {
		private static final long serialVersionUID = 1L;

		@Override
		public Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> map(
				Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> value) throws Exception {
			return null;
		}

	};

	TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInfoParser.parse("Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>"));

	Assert.assertTrue(ti.isTupleType());
	Assert.assertEquals(9, ti.getArity());
	Assert.assertTrue(ti instanceof TupleTypeInfo);
	List<FlatFieldDescriptor> ffd = new ArrayList<FlatFieldDescriptor>();
	((TupleTypeInfo) ti).getKey("f3", 0, ffd);
	Assert.assertTrue(ffd.size() == 1);
	Assert.assertEquals(3, ffd.get(0).getPosition() );

	TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
	Assert.assertEquals(Tuple9.class, tti.getTypeClass());
	
	for (int i = 0; i < 9; i++) {
		Assert.assertTrue(tti.getTypeAt(i) instanceof BasicTypeInfo);
	}

	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(1));
	Assert.assertEquals(BasicTypeInfo.DOUBLE_TYPE_INFO, tti.getTypeAt(2));
	Assert.assertEquals(BasicTypeInfo.FLOAT_TYPE_INFO, tti.getTypeAt(3));
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti.getTypeAt(4));
	Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(5));
	Assert.assertEquals(BasicTypeInfo.CHAR_TYPE_INFO, tti.getTypeAt(6));
	Assert.assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, tti.getTypeAt(7));
	Assert.assertEquals(BasicTypeInfo.BYTE_TYPE_INFO, tti.getTypeAt(8));

	// use getForObject()
	Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte> t = new Tuple9<Integer, Long, Double, Float, Boolean, String, Character, Short, Byte>(
			1, 1L, 1.0, 1.0F, false, "Hello World", 'w', (short) 1, (byte) 1);

	Assert.assertTrue(TypeExtractor.getForObject(t) instanceof TupleTypeInfo);
	TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) TypeExtractor.getForObject(t);

	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti2.getTypeAt(1));
	Assert.assertEquals(BasicTypeInfo.DOUBLE_TYPE_INFO, tti2.getTypeAt(2));
	Assert.assertEquals(BasicTypeInfo.FLOAT_TYPE_INFO, tti2.getTypeAt(3));
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti2.getTypeAt(4));
	Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti2.getTypeAt(5));
	Assert.assertEquals(BasicTypeInfo.CHAR_TYPE_INFO, tti2.getTypeAt(6));
	Assert.assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, tti2.getTypeAt(7));
	Assert.assertEquals(BasicTypeInfo.BYTE_TYPE_INFO, tti2.getTypeAt(8));
	
	// test that getForClass does not work
	try {
		TypeExtractor.getForClass(Tuple9.class);
		Assert.fail("Exception expected here");
	} catch (InvalidTypesException e) {
		// that is correct
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:68,代码来源:TypeExtractorTest.java


示例9: projectTuple9

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Projects a pair of joined elements to a {@link Tuple} with the previously selected fields.
 * Requires the classes of the fields of the resulting tuples.
 *
 * @return The projected data set.
 *
 * @see Tuple
 * @see DataSet
 */
public <T0, T1, T2, T3, T4, T5, T6, T7, T8> ProjectJoin<I1, I2, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> projectTuple9() {
	TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes);
	TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> tType = new TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(fTypes);

	return new ProjectJoin<I1, I2, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(this.ds1, this.ds2, this.keys1, this.keys2, this.hint, this.fieldIndexes, this.isFieldInFirst, tType, this);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:16,代码来源:JoinOperator.java


示例10: projectTuple9

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields.
 *
 * @return The projected DataSet.
 * @see Tuple
 * @see DataSet
 */
public <T0, T1, T2, T3, T4, T5, T6, T7, T8> ProjectOperator<T, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> projectTuple9() {
	TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, ds.getType());
	TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> tType = new TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(fTypes);

	return new ProjectOperator<T, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(this.ds, this.fieldIndexes, tType);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:ProjectOperator.java


示例11: projectTuple9

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Projects a pair of crossed elements to a {@link Tuple} with the previously selected fields.
 *
 * @return The projected data set.
 *
 * @see Tuple
 * @see DataSet
 */
public <T0, T1, T2, T3, T4, T5, T6, T7, T8> ProjectCross<I1, I2, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> projectTuple9() {
	TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes);
	TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> tType = new TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(fTypes);

	return new ProjectCross<I1, I2, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(this.ds1, this.ds2, this.fieldIndexes, this.isFieldInFirst, tType, this, hint);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:CrossOperator.java


示例12: projectTuple9

import org.apache.flink.api.java.tuple.Tuple9; //导入依赖的package包/类
/**
 * Projects a {@link Tuple} {@link DataStream} to the previously selected fields.
 *
 * @return The projected DataStream.
 * @see Tuple
 * @see DataStream
 */
public <T0, T1, T2, T3, T4, T5, T6, T7, T8> SingleOutputStreamOperator<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> projectTuple9() {
	TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType());
	TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>> tType = new TupleTypeInfo<Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(fTypes);

	return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple9<T0, T1, T2, T3, T4, T5, T6, T7, T8>>(fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig())));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:StreamProjection.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java LiquidDictionary类代码示例发布时间:2022-05-22
下一篇:
Java BufferPool类代码示例发布时间: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