org.apache.flink.types.Nothing Java Examples

The following examples show how to use org.apache.flink.types.Nothing. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SinkJoiner.java    From flink with Apache License 2.0 5 votes vote down vote up
public SinkJoiner(OptimizerNode input1, OptimizerNode input2) {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));

	DagConnection conn1 = new DagConnection(input1, this, null, ExecutionMode.PIPELINED);
	DagConnection conn2 = new DagConnection(input2, this, null, ExecutionMode.PIPELINED);
	
	this.input1 = conn1;
	this.input2 = conn2;
	
	setParallelism(1);
}
 
Example #2
Source File: GenericDataSinkBaseTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourceWithRuntimeContext() {
	try {
		TestRichOutputFormat out = new TestRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		final HashMap<String, Accumulator<?, ?>> accumulatorMap = new HashMap<String, Accumulator<?, ?>>();
		final HashMap<String, Future<Path>> cpTasks = new HashMap<>();
		final TaskInfo taskInfo = new TaskInfo("test_sink", 1, 0, 1, 0);
		executionConfig.disableObjectReuse();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
	
			assertEquals(out.output, asList(TestIOData.RICH_NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
		assertEquals(out.output, asList(TestIOData.RICH_NAMES));
	} catch(Exception e){
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #3
Source File: GenericDataSinkBaseTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourcePlain() {
	try {
		TestNonRichOutputFormat out = new TestNonRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		executionConfig.disableObjectReuse();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #4
Source File: GenericDataSinkBaseTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourceWithRuntimeContext() {
	try {
		TestRichOutputFormat out = new TestRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		final HashMap<String, Accumulator<?, ?>> accumulatorMap = new HashMap<String, Accumulator<?, ?>>();
		final HashMap<String, Future<Path>> cpTasks = new HashMap<>();
		final TaskInfo taskInfo = new TaskInfo("test_sink", 1, 0, 1, 0);
		executionConfig.disableObjectReuse();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
	
			assertEquals(out.output, asList(TestIOData.RICH_NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
		assertEquals(out.output, asList(TestIOData.RICH_NAMES));
	} catch(Exception e){
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #5
Source File: SinkJoiner.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public SinkJoiner(OptimizerNode input1, OptimizerNode input2) {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));

	DagConnection conn1 = new DagConnection(input1, this, null, ExecutionMode.PIPELINED);
	DagConnection conn2 = new DagConnection(input2, this, null, ExecutionMode.PIPELINED);
	
	this.input1 = conn1;
	this.input2 = conn2;
	
	setParallelism(1);
}
 
Example #6
Source File: GenericDataSinkBaseTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourcePlain() {
	try {
		TestNonRichOutputFormat out = new TestNonRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		executionConfig.disableObjectReuse();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #7
Source File: SinkJoiner.java    From flink with Apache License 2.0 5 votes vote down vote up
public SinkJoiner(OptimizerNode input1, OptimizerNode input2) {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));

	DagConnection conn1 = new DagConnection(input1, this, null, ExecutionMode.PIPELINED);
	DagConnection conn2 = new DagConnection(input2, this, null, ExecutionMode.PIPELINED);
	
	this.input1 = conn1;
	this.input2 = conn2;
	
	setParallelism(1);
}
 
Example #8
Source File: GenericDataSinkBaseTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourcePlain() {
	try {
		TestNonRichOutputFormat out = new TestNonRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		executionConfig.disableObjectReuse();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		sink.executeOnCollections(asList(TestIOData.NAMES), null, executionConfig);
		assertEquals(out.output, asList(TestIOData.NAMES));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #9
Source File: GenericDataSinkBaseTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataSourceWithRuntimeContext() {
	try {
		TestRichOutputFormat out = new TestRichOutputFormat();
		GenericDataSinkBase<String> sink = new GenericDataSinkBase<String>(
				out,
				new UnaryOperatorInformation<String, Nothing>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.getInfoFor(Nothing.class)),
				"test_sink");
		sink.setInput(source);

		ExecutionConfig executionConfig = new ExecutionConfig();
		final HashMap<String, Accumulator<?, ?>> accumulatorMap = new HashMap<String, Accumulator<?, ?>>();
		final HashMap<String, Future<Path>> cpTasks = new HashMap<>();
		final TaskInfo taskInfo = new TaskInfo("test_sink", 1, 0, 1, 0);
		executionConfig.disableObjectReuse();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
	
			assertEquals(out.output, asList(TestIOData.RICH_NAMES));

		executionConfig.enableObjectReuse();
		out.clear();
		in.reset();
		
		sink.executeOnCollections(asList(TestIOData.NAMES), new RuntimeUDFContext(
				taskInfo, null, executionConfig, cpTasks, accumulatorMap, new UnregisteredMetricsGroup()),
				executionConfig);
		assertEquals(out.output, asList(TestIOData.RICH_NAMES));
	} catch(Exception e){
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #10
Source File: WorksetIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
SingleRootJoiner() {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
	
	setParallelism(1);
}
 
Example #11
Source File: NothingTypeInfo.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
	return Nothing.class;
}
 
Example #12
Source File: NothingTypeInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
	throw new RuntimeException("The Nothing type cannot have a serializer.");
}
 
Example #13
Source File: NothingTypeInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
	return Nothing.class;
}
 
Example #14
Source File: WorksetIterationNode.java    From flink with Apache License 2.0 4 votes vote down vote up
SingleRootJoiner() {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
	
	setParallelism(1);
}
 
Example #15
Source File: NothingTypeInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
	throw new RuntimeException("The Nothing type cannot have a serializer.");
}
 
Example #16
Source File: NothingTypeInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
	return Nothing.class;
}
 
Example #17
Source File: WorksetIterationNode.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
SingleRootJoiner() {
	super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
	
	setParallelism(1);
}
 
Example #18
Source File: NothingTypeInfo.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
	throw new RuntimeException("The Nothing type cannot have a serializer.");
}
 
Example #19
Source File: GenericDataSinkBase.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(OutputFormat<IN> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);

	checkNotNull(f, "The OutputFormat may not be null.");
	this.formatWrapper = new UserCodeObjectWrapper<OutputFormat<IN>>(f);
}
 
Example #20
Source File: GenericDataSinkBase.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(OutputFormat<IN> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);

	checkNotNull(f, "The OutputFormat may not be null.");
	this.formatWrapper = new UserCodeObjectWrapper<OutputFormat<IN>>(f);
}
 
Example #21
Source File: GenericDataSinkBase.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(OutputFormat<IN> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);

	checkNotNull(f, "The OutputFormat may not be null.");
	this.formatWrapper = new UserCodeObjectWrapper<OutputFormat<IN>>(f);
}
 
Example #22
Source File: GenericDataSinkBase.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(UserCodeWrapper<? extends OutputFormat<IN>> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);
	this.formatWrapper = checkNotNull(f, "The OutputFormat class may not be null.");
}
 
Example #23
Source File: GenericDataSinkBase.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(UserCodeWrapper<? extends OutputFormat<IN>> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);
	this.formatWrapper = checkNotNull(f, "The OutputFormat class may not be null.");
}
 
Example #24
Source File: GenericDataSinkBase.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a GenericDataSink with the provided {@link org.apache.flink.api.common.io.OutputFormat} implementation
 * and the given name.
 *
 * @param f The {@link org.apache.flink.api.common.io.OutputFormat} implementation used to sink the data.
 * @param name The given name for the sink, used in plans, logs and progress messages.
 */
public GenericDataSinkBase(UserCodeWrapper<? extends OutputFormat<IN>> f, UnaryOperatorInformation<IN, Nothing> operatorInfo, String name) {
	super(operatorInfo, name);
	this.formatWrapper = checkNotNull(f, "The OutputFormat class may not be null.");
}