本文整理汇总了Java中org.apache.flink.api.java.io.LocalCollectionOutputFormat类的典型用法代码示例。如果您正苦于以下问题:Java LocalCollectionOutputFormat类的具体用法?Java LocalCollectionOutputFormat怎么用?Java LocalCollectionOutputFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalCollectionOutputFormat类属于org.apache.flink.api.java.io包,在下文中一共展示了LocalCollectionOutputFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testInvalidAkkaConfiguration
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
/**
* Ensure that that Akka configuration parameters can be set.
*/
@Test(expected=FlinkException.class)
public void testInvalidAkkaConfiguration() throws Throwable {
Configuration config = new Configuration();
config.setString(AkkaOptions.STARTUP_TIMEOUT, INVALID_STARTUP_TIMEOUT);
final ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment(
cluster.getHostname(),
cluster.getPort(),
config
);
env.getConfig().disableSysoutLogging();
DataSet<String> result = env.createInput(new TestNonRichInputFormat());
result.output(new LocalCollectionOutputFormat<>(new ArrayList<String>()));
try {
env.execute();
Assert.fail("Program should not run successfully, cause of invalid akka settings.");
} catch (ProgramInvocationException ex) {
throw ex.getCause();
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:RemoteEnvironmentITCase.java
示例2: testProgram
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Override
protected void testProgram() throws Exception {
final int numIters = 4;
final double expectedFactor = (int) Math.pow(7, numIters);
// this is an artificial program, it does not compute anything sensical
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
@SuppressWarnings("unchecked")
DataSet<Tuple2<Long, Double>> initialData = env.fromElements(new Tuple2<Long, Double>(1L, 1.0), new Tuple2<Long, Double>(2L, 2.0),
new Tuple2<Long, Double>(3L, 3.0), new Tuple2<Long, Double>(4L, 4.0),
new Tuple2<Long, Double>(5L, 5.0), new Tuple2<Long, Double>(6L, 6.0));
DataSet<Tuple2<Long, Double>> result = MultipleJoinsWithSolutionSetCompilerTest.constructPlan(initialData, numIters);
List<Tuple2<Long, Double>> resultCollector = new ArrayList<Tuple2<Long, Double>>();
result.output(new LocalCollectionOutputFormat<>(resultCollector));
env.execute();
for (Tuple2<Long, Double> tuple : resultCollector) {
Assert.assertEquals(expectedFactor * tuple.f0, tuple.f1.doubleValue(), 0.0);
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:MultipleSolutionSetJoinsITCase.java
示例3: testProgram
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Override
protected void testProgram() throws Exception {
try {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
DataSet<Tuple2<Long, Long>> input = env.generateSequence(0, 9).map(new Duplicator<Long>());
DeltaIteration<Tuple2<Long, Long>, Tuple2<Long, Long>> iteration = input.iterateDelta(input, 5, 1);
iteration.closeWith(iteration.getWorkset(), iteration.getWorkset().map(new TestMapper()))
.output(new LocalCollectionOutputFormat<Tuple2<Long, Long>>(result));
env.execute();
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:DeltaIterationNotDependingOnSolutionSetITCase.java
示例4: testProgramWithAutoParallelism
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testProgramWithAutoParallelism() {
try {
env.setParallelism(ExecutionConfig.PARALLELISM_AUTO_MAX);
env.getConfig().disableSysoutLogging();
DataSet<Integer> result = env
.createInput(new ParallelismDependentInputFormat())
.rebalance()
.mapPartition(new ParallelismDependentMapPartition());
List<Integer> resultCollection = new ArrayList<Integer>();
result.output(new LocalCollectionOutputFormat<Integer>(resultCollection));
env.execute();
assertEquals(PARALLELISM, resultCollection.size());
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:AutoParallelismITCase.java
示例5: testInvalidAkkaConfiguration
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
/**
* Ensure that that Akka configuration parameters can be set.
*/
@Test(expected = FlinkException.class)
public void testInvalidAkkaConfiguration() throws Throwable {
Configuration config = new Configuration();
config.setString(AkkaOptions.STARTUP_TIMEOUT, INVALID_STARTUP_TIMEOUT);
final ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment(
cluster.getHostname(),
cluster.getPort(),
config
);
env.getConfig().disableSysoutLogging();
DataSet<String> result = env.createInput(new TestNonRichInputFormat());
result.output(new LocalCollectionOutputFormat<>(new ArrayList<String>()));
try {
env.execute();
Assert.fail("Program should not run successfully, cause of invalid akka settings.");
} catch (ProgramInvocationException ex) {
throw ex.getCause();
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:RemoteEnvironmentITCase.java
示例6: testBulkIteration
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testBulkIteration() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
IterativeDataSet<Integer> iteration = env.fromElements(1).iterate(10);
DataSet<Integer> result = iteration.closeWith(iteration.map(new AddSuperstepNumberMapper()));
List<Integer> collected = new ArrayList<Integer>();
result.output(new LocalCollectionOutputFormat<Integer>(collected));
env.execute();
assertEquals(1, collected.size());
assertEquals(56, collected.get(0).intValue());
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CollectionExecutionIterationTest.java
示例7: testUnaryOp
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testUnaryOp() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
DataSet<String> bcData = env.fromElements(SUFFIX);
List<String> result = new ArrayList<String>();
env.fromElements(TEST_DATA)
.map(new SuffixAppender()).withBroadcastSet(bcData, BC_VAR_NAME)
.output(new LocalCollectionOutputFormat<String>(result));
env.execute();
assertEquals(TEST_DATA.length, result.size());
for (String s : result) {
assertTrue(s.indexOf(SUFFIX) > 0);
}
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:CollectionExecutionWithBroadcastVariableTest.java
示例8: testBinaryOp
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testBinaryOp() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
DataSet<String> bcData = env.fromElements(SUFFIX);
DataSet<String> inData = env.fromElements(TEST_DATA);
List<String> result = new ArrayList<String>();
inData.cross(inData).with(new SuffixCross()).withBroadcastSet(bcData, BC_VAR_NAME)
.output(new LocalCollectionOutputFormat<String>(result));
env.execute();
assertEquals(TEST_DATA.length * TEST_DATA.length, result.size());
for (String s : result) {
assertTrue(s.indexOf(SUFFIX) == 2);
}
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:CollectionExecutionWithBroadcastVariableTest.java
示例9: testWithVertexAndEdgeStringValues
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testWithVertexAndEdgeStringValues() throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, String, String> input = Graph.fromDataSet(
SummarizationData.getVertices(env),
SummarizationData.getEdges(env),
env);
List<Vertex<Long, Summarization.VertexValue<String>>> summarizedVertices = new ArrayList<>();
List<Edge<Long, EdgeValue<String>>> summarizedEdges = new ArrayList<>();
Graph<Long, Summarization.VertexValue<String>, EdgeValue<String>> output =
input.run(new Summarization<>());
output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices));
output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges));
env.execute();
validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices);
validateEdges(SummarizationData.EXPECTED_EDGES_WITH_VALUES, summarizedEdges);
}
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:SummarizationITCase.java
示例10: testWithVertexAndAbsentEdgeStringValues
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testWithVertexAndAbsentEdgeStringValues() throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, String, NullValue> input = Graph.fromDataSet(
SummarizationData.getVertices(env),
SummarizationData.getEdges(env),
env)
.run(new TranslateEdgeValues<>(new ToNullValue<>()));
List<Vertex<Long, Summarization.VertexValue<String>>> summarizedVertices = new ArrayList<>();
List<Edge<Long, EdgeValue<NullValue>>> summarizedEdges = new ArrayList<>();
Graph<Long, Summarization.VertexValue<String>, EdgeValue<NullValue>> output =
input.run(new Summarization<>());
output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices));
output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges));
env.execute();
validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices);
validateEdges(SummarizationData.EXPECTED_EDGES_ABSENT_VALUES, summarizedEdges);
}
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:SummarizationITCase.java
示例11: testWithVertexAndEdgeLongValues
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testWithVertexAndEdgeLongValues() throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> input = Graph.fromDataSet(
SummarizationData.getVertices(env),
SummarizationData.getEdges(env),
env)
.run(new TranslateVertexValues<>(new StringToLong()))
.run(new TranslateEdgeValues<>(new StringToLong()));
List<Vertex<Long, Summarization.VertexValue<Long>>> summarizedVertices = new ArrayList<>();
List<Edge<Long, EdgeValue<Long>>> summarizedEdges = new ArrayList<>();
Graph<Long, Summarization.VertexValue<Long>, EdgeValue<Long>> output =
input.run(new Summarization<>());
output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices));
output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges));
env.execute();
validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices);
validateEdges(SummarizationData.EXPECTED_EDGES_WITH_VALUES, summarizedEdges);
}
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:SummarizationITCase.java
示例12: performTest
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
protected void performTest(ExecutionEnvironment env, LDBCToFlink ldbcToFlink)
throws Exception {
List<LDBCVertex> vertexList = Lists.newArrayList();
List<LDBCEdge> edgeList = Lists.newArrayList();
ldbcToFlink.getVertices().output(
new LocalCollectionOutputFormat<>(vertexList));
ldbcToFlink.getEdges().output(
new LocalCollectionOutputFormat<>(edgeList));
env.execute();
Assert.assertEquals(80, vertexList.size());
Assert.assertEquals(230, edgeList.size());
}
开发者ID:s1ck,项目名称:ldbc-flink-import,代码行数:17,代码来源:LDBCToFlinkTest.java
示例13: testCreateEmptyGraph
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testCreateEmptyGraph() throws Exception {
LogicalGraphLayout logicalGraphLayout = getFactory().createEmptyGraph();
Collection<GraphHead> loadedGraphHeads = Lists.newArrayList();
Collection<Vertex> loadedVertices = Lists.newArrayList();
Collection<Edge> loadedEdges = Lists.newArrayList();
logicalGraphLayout.getGraphHead().output(new LocalCollectionOutputFormat<>(loadedGraphHeads));
logicalGraphLayout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices));
logicalGraphLayout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges));
getExecutionEnvironment().execute();
assertEquals(0L, loadedGraphHeads.size());
assertEquals(0L, loadedVertices.size());
assertEquals(0L, loadedEdges.size());
}
开发者ID:dbs-leipzig,项目名称:gradoop,代码行数:19,代码来源:LogicalGraphLayoutFactoryTest.java
示例14: testFromDataSetsWithoutGraphHead
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testFromDataSetsWithoutGraphHead() throws Exception {
FlinkAsciiGraphLoader loader = getLoaderFromString("()-[]->(),[()]");
GraphCollectionLayout collectionLayout = getFactory()
.fromDataSets(
getExecutionEnvironment().fromCollection(loader.getGraphHeads()),
getExecutionEnvironment().fromCollection(loader.getVertices()),
getExecutionEnvironment().fromCollection(loader.getEdges()));
Collection<GraphHead> loadedGraphHeads = Lists.newArrayList();
Collection<Vertex> loadedVertices = Lists.newArrayList();
Collection<Edge> loadedEdges = Lists.newArrayList();
collectionLayout.getGraphHeads().output(new LocalCollectionOutputFormat<>(loadedGraphHeads));
collectionLayout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices));
collectionLayout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges));
getExecutionEnvironment().execute();
validateEPGMElementCollections(loader.getGraphHeads(), loadedGraphHeads);
validateEPGMElementCollections(loader.getVertices(), loadedVertices);
validateEPGMElementCollections(loader.getEdges(), loadedEdges);
validateEPGMGraphElementCollections(loader.getVertices(), loadedVertices);
validateEPGMGraphElementCollections(loader.getEdges(), loadedEdges);
}
开发者ID:dbs-leipzig,项目名称:gradoop,代码行数:27,代码来源:GraphCollectionLayoutFactoryTest.java
示例15: testFromCollections
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testFromCollections() throws Exception {
FlinkAsciiGraphLoader loader = getSocialNetworkLoader();
GraphCollectionLayout collectionLayout = getFactory()
.fromCollections(loader.getGraphHeads(),
loader.getVertices(),
loader.getEdges());
Collection<GraphHead> loadedGraphHeads = Lists.newArrayList();
Collection<Vertex> loadedVertices = Lists.newArrayList();
Collection<Edge> loadedEdges = Lists.newArrayList();
collectionLayout.getGraphHeads().output(new LocalCollectionOutputFormat<>(loadedGraphHeads));
collectionLayout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices));
collectionLayout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges));
getExecutionEnvironment().execute();
validateEPGMElementCollections(loader.getGraphHeads(), loadedGraphHeads);
validateEPGMElementCollections(loader.getVertices(), loadedVertices);
validateEPGMElementCollections(loader.getEdges(), loadedEdges);
validateEPGMGraphElementCollections(loader.getVertices(), loadedVertices);
validateEPGMGraphElementCollections(loader.getEdges(), loadedEdges);
}
开发者ID:dbs-leipzig,项目名称:gradoop,代码行数:26,代码来源:GraphCollectionLayoutFactoryTest.java
示例16: testCreateEmptyCollection
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testCreateEmptyCollection() throws Exception {
GraphCollectionLayout graphCollectionLayout = getFactory().createEmptyCollection();
Collection<GraphHead> loadedGraphHeads = Lists.newArrayList();
Collection<Vertex> loadedVertices = Lists.newArrayList();
Collection<Edge> loadedEdges = Lists.newArrayList();
graphCollectionLayout.getGraphHeads().output(new LocalCollectionOutputFormat<>(loadedGraphHeads));
graphCollectionLayout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices));
graphCollectionLayout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges));
getExecutionEnvironment().execute();
assertEquals(0L, loadedGraphHeads.size());
assertEquals(0L, loadedVertices.size());
assertEquals(0L, loadedEdges.size());
}
开发者ID:dbs-leipzig,项目名称:gradoop,代码行数:19,代码来源:GraphCollectionLayoutFactoryTest.java
示例17: testProgram
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Override
protected void testProgram() throws Exception {
final int NUM_ITERS = 4;
final double expectedFactor = (int) Math.pow(7, NUM_ITERS);
// this is an artificial program, it does not compute anything sensical
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
@SuppressWarnings("unchecked")
DataSet<Tuple2<Long, Double>> initialData = env.fromElements(new Tuple2<Long, Double>(1L, 1.0), new Tuple2<Long, Double>(2L, 2.0),
new Tuple2<Long, Double>(3L, 3.0), new Tuple2<Long, Double>(4L, 4.0),
new Tuple2<Long, Double>(5L, 5.0), new Tuple2<Long, Double>(6L, 6.0));
DataSet<Tuple2<Long, Double>> result = MultipleJoinsWithSolutionSetCompilerTest.constructPlan(initialData, NUM_ITERS);
List<Tuple2<Long, Double>> resultCollector = new ArrayList<Tuple2<Long,Double>>();
result.output(new LocalCollectionOutputFormat<Tuple2<Long,Double>>(resultCollector));
env.execute();
for (Tuple2<Long, Double> tuple : resultCollector) {
Assert.assertEquals(expectedFactor * tuple.f0, tuple.f1.doubleValue(), 0.0);
}
}
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:26,代码来源:MultipleSolutionSetJoinsITCase.java
示例18: testBulkIteration
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testBulkIteration() {
try {
ExecutionEnvironment env = new CollectionEnvironment();
IterativeDataSet<Integer> iteration = env.fromElements(1).iterate(10);
DataSet<Integer> result = iteration.closeWith(iteration.map(new AddSuperstepNumberMapper()));
List<Integer> collected = new ArrayList<Integer>();
result.output(new LocalCollectionOutputFormat<Integer>(collected));
env.execute();
assertEquals(1, collected.size());
assertEquals(56, collected.get(0).intValue());
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:23,代码来源:CollectionExecutionIterationTest.java
示例19: testUnaryOp
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testUnaryOp() {
try {
ExecutionEnvironment env = new CollectionEnvironment();
DataSet<String> bcData = env.fromElements(SUFFIX);
List<String> result = new ArrayList<String>();
env.fromElements(TEST_DATA)
.map(new SuffixAppender()).withBroadcastSet(bcData, BC_VAR_NAME)
.output(new LocalCollectionOutputFormat<String>(result));
env.execute();
assertEquals(TEST_DATA.length, result.size());
for (String s : result) {
assertTrue(s.indexOf(SUFFIX) > 0);
}
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:26,代码来源:CollectionExecutionWithBroadcastVariableTest.java
示例20: testBinaryOp
import org.apache.flink.api.java.io.LocalCollectionOutputFormat; //导入依赖的package包/类
@Test
public void testBinaryOp() {
try {
ExecutionEnvironment env = new CollectionEnvironment();
DataSet<String> bcData = env.fromElements(SUFFIX);
DataSet<String> inData = env.fromElements(TEST_DATA);
List<String> result = new ArrayList<String>();
inData.cross(inData).with(new SuffixCross()).withBroadcastSet(bcData, BC_VAR_NAME)
.output(new LocalCollectionOutputFormat<String>(result));
env.execute();
assertEquals(TEST_DATA.length * TEST_DATA.length, result.size());
for (String s : result) {
assertTrue(s.indexOf(SUFFIX) == 2);
}
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:26,代码来源:CollectionExecutionWithBroadcastVariableTest.java
注:本文中的org.apache.flink.api.java.io.LocalCollectionOutputFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论