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


Java DataSet.sortPartition方法代码示例

本文整理汇总了Java中org.apache.flink.api.java.DataSet.sortPartition方法的典型用法代码示例。如果您正苦于以下问题:Java DataSet.sortPartition方法的具体用法?Java DataSet.sortPartition怎么用?Java DataSet.sortPartition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.java.DataSet的用法示例。


在下文中一共展示了DataSet.sortPartition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSortPartitionWithKeySelector1

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionWithKeySelector1() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// should work
	try {
		tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, Integer>() {
			@Override
			public Integer getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
				return value.f0;
			}
		}, Order.ASCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:SortPartitionTest.java

示例2: testSortPartitionWithKeySelector4

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionWithKeySelector4() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// should work
	try {
		tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, Tuple2<Integer, Long>>() {
			@Override
			public Tuple2<Integer, Long> getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
				return new Tuple2<>(value.f0, value.f1);
			}
		}, Order.ASCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:SortPartitionTest.java

示例3: testSortPartitionWithExpressionKeys3

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithExpressionKeys3() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// must not work
	tupleDs.sortPartition("f2.nested", Order.ASCENDING);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SortPartitionTest.java

示例4: testSortPartitionPositionKeys1

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionPositionKeys1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.sortPartition(0, Order.ASCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:SortPartitionTest.java

示例5: testSortPartitionWithPositionKeys3

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithPositionKeys3() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// must not work
	tupleDs.sortPartition(2, Order.ASCENDING);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SortPartitionTest.java

示例6: testSortPartitionWithPositionKeys4

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithPositionKeys4() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// must not work
	tupleDs.sortPartition(3, Order.ASCENDING);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SortPartitionTest.java

示例7: testSortPartitionExpressionKeys1

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionExpressionKeys1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.sortPartition("f1", Order.ASCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:SortPartitionTest.java

示例8: testSortPartitionWithExpressionKeys4

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithExpressionKeys4() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// must not work
	tupleDs.sortPartition("f3", Order.ASCENDING);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:SortPartitionTest.java

示例9: testSortPartitionWithKeySelector2

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithKeySelector2() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);

	// must not work
	tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, Long[]>() {
		@Override
		public Long[] getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
			return value.f3;
		}
	}, Order.ASCENDING);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:SortPartitionTest.java


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