Java源码示例:org.apache.flink.types.Nothing
示例1
@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());
}
}
示例2
@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());
}
}
示例3
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);
}
示例4
@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());
}
}
示例5
@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());
}
}
示例6
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);
}
示例7
@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());
}
}
示例8
@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());
}
}
示例9
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);
}
示例10
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
return Nothing.class;
}
示例11
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
throw new RuntimeException("The Nothing type cannot have a serializer.");
}
示例12
SingleRootJoiner() {
super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
setParallelism(1);
}
示例13
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
return Nothing.class;
}
示例14
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
throw new RuntimeException("The Nothing type cannot have a serializer.");
}
示例15
SingleRootJoiner() {
super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
setParallelism(1);
}
示例16
@Override
@PublicEvolving
public Class<Nothing> getTypeClass() {
return Nothing.class;
}
示例17
@Override
@PublicEvolving
public TypeSerializer<Nothing> createSerializer(ExecutionConfig executionConfig) {
throw new RuntimeException("The Nothing type cannot have a serializer.");
}
示例18
SingleRootJoiner() {
super(new NoOpBinaryUdfOp<Nothing>(new NothingTypeInfo()));
setParallelism(1);
}
示例19
/**
* 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);
}
示例20
/**
* 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);
}
示例21
/**
* 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);
}
示例22
/**
* 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.");
}
示例23
/**
* 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.");
}
示例24
/**
* 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.");
}