Search in sources :

Example 1 with NothingTypeInfo

use of org.apache.flink.api.common.typeinfo.NothingTypeInfo in project flink by apache.

the class NothingTypeInfoTest method testNothingTypeInfoInequality.

@Test
public void testNothingTypeInfoInequality() {
    NothingTypeInfo tpeInfo1 = new NothingTypeInfo();
    BasicTypeInfo<Integer> tpeInfo2 = BasicTypeInfo.getInfoFor(Integer.class);
    assertNotEquals(tpeInfo1, tpeInfo2);
    assertNotEquals(tpeInfo2, tpeInfo1);
}
Also used : NothingTypeInfo(org.apache.flink.api.common.typeinfo.NothingTypeInfo) Test(org.junit.Test)

Example 2 with NothingTypeInfo

use of org.apache.flink.api.common.typeinfo.NothingTypeInfo in project flink by apache.

the class NothingTypeInfoTest method testNothingTypeInfoEquality.

@Test
public void testNothingTypeInfoEquality() {
    NothingTypeInfo tpeInfo1 = new NothingTypeInfo();
    NothingTypeInfo tpeInfo2 = new NothingTypeInfo();
    assertEquals(tpeInfo1, tpeInfo2);
    assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode());
}
Also used : NothingTypeInfo(org.apache.flink.api.common.typeinfo.NothingTypeInfo) Test(org.junit.Test)

Example 3 with NothingTypeInfo

use of org.apache.flink.api.common.typeinfo.NothingTypeInfo in project flink by apache.

the class DataSink method translateToDataFlow.

// --------------------------------------------------------------------------------------------
protected GenericDataSinkBase<T> translateToDataFlow(Operator<T> input) {
    // select the name (or create a default one)
    String name = this.name != null ? this.name : this.format.toString();
    GenericDataSinkBase<T> sink = new GenericDataSinkBase<>(this.format, new UnaryOperatorInformation<>(this.type, new NothingTypeInfo()), name);
    // set input
    sink.setInput(input);
    // set parameters
    if (this.parameters != null) {
        sink.getParameters().addAll(this.parameters);
    }
    // set parallelism
    if (this.parallelism > 0) {
        // use specified parallelism
        sink.setParallelism(this.parallelism);
    } else {
        // if no parallelism has been specified, use parallelism of input operator to enable
        // chaining
        sink.setParallelism(input.getParallelism());
    }
    if (this.sortKeyPositions != null) {
        // configure output sorting
        Ordering ordering = new Ordering();
        for (int i = 0; i < this.sortKeyPositions.length; i++) {
            ordering.appendOrdering(this.sortKeyPositions[i], null, this.sortOrders[i]);
        }
        sink.setLocalOrder(ordering);
    }
    return sink;
}
Also used : GenericDataSinkBase(org.apache.flink.api.common.operators.GenericDataSinkBase) Ordering(org.apache.flink.api.common.operators.Ordering) NothingTypeInfo(org.apache.flink.api.common.typeinfo.NothingTypeInfo)

Aggregations

NothingTypeInfo (org.apache.flink.api.common.typeinfo.NothingTypeInfo)3 Test (org.junit.Test)2 GenericDataSinkBase (org.apache.flink.api.common.operators.GenericDataSinkBase)1 Ordering (org.apache.flink.api.common.operators.Ordering)1