flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/BigUserProgramJobSubmitITCase.java
/**
	 * Use a map function that references a 100MB byte array.
	 */
Use a map function that references a 100MB byte array.
Use a map function that references a 100MB byte array .
@Test
	public void bigDataInMap() throws Exception {
		final byte[] data = new byte[100 * 1024 * 1024]; 
		rnd.nextBytes(data); 
		data[1] = 0;
		data[3] = 0;
		data[5] = 0;
		TestListResultSink<String> resultSink = new TestListResultSink<>();
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		DataStream<Integer> src = env.fromElements(1, 3, 5);
		src.map(new MapFunction<Integer, String>() {
			private static final long serialVersionUID = 1L;
			@Override
			public String map(Integer value) throws Exception {
				return "x " + value + " " + data[value];
			}
		}).addSink(resultSink);
		env.execute();
		List<String> expected = Arrays.asList("x 1 0", "x 3 0", "x 5 0");
		List<String> result = resultSink.getResult();
		Collections.sort(expected);
		Collections.sort(result);
		assertEquals(expected, result);
	}
@ Test public void bigDataInMap ( ) throws Exception { final byte [ ] data = new byte [ 100 * 1024 * 1024 ] ; rnd . nextBytes ( data ) ; data [ 1 ] = 0 ; data [ 3 ] = 0 ; data [ 5 ] = 0 ; TestListResultSink < String > resultSink = new TestListResultSink < > ( ) ; StreamExecutionEnvironment env = StreamExecutionEnvironment . getExecutionEnvironment ( ) ; DataStream < Integer > src = env . fromElements ( 1 , 3 , 5 ) ; src . map ( new MapFunction < Integer , String > ( ) { private static final long serialVersionUID = 1L ; @ Override public String map ( Integer value ) throws Exception { return "x " + value + " " + data [ value ] ; } } ) . addSink ( resultSink ) ; env . execute ( ) ; List < String > expected = Arrays . asList ( "x 1 0" , "x 3 0" , "x 5 0" ) ; List < String > result = resultSink . getResult ( ) ; Collections . sort ( expected ) ; Collections . sort ( result ) ; assertEquals ( expected , result ) ; }
Use a map function that references a 100MB byte array.
Use a map function that references a 100MB byte array .
// 100 MB // use random data so that Java does not optimise it away