Java Code Examples for org.apache.flink.api.java.typeutils.EnumTypeInfo
The following examples show how to use
org.apache.flink.api.java.typeutils.EnumTypeInfo.
These examples are extracted from open source projects.
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 Project: flink Author: apache File: DataStreamTest.java License: Apache License 2.0 | 5 votes |
@Test public void testEnumKeyRejection() { KeySelector<Tuple2<TestEnum, String>, TestEnum> keySelector = value -> value.f0; StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Tuple2<TestEnum, String>> input = env.fromElements( Tuple2.of(TestEnum.FOO, "Foo"), Tuple2.of(TestEnum.BAR, "Bar")); expectedException.expect(InvalidProgramException.class); expectedException.expectMessage(new StringStartsWith("Type " + EnumTypeInfo.of(TestEnum.class) + " cannot be used as key.")); input.keyBy(keySelector); }
Example #2
Source Project: flink Author: apache File: KeyedStream.java License: Apache License 2.0 | 4 votes |
private static boolean isEnumType(TypeInformation<?> type) { return type instanceof EnumTypeInfo; }
Example #3
Source Project: Flink-CEPplus Author: ljygz File: Types.java License: Apache License 2.0 | 2 votes |
/** * Returns type information for Java enumerations. Null values are not supported. * * @param enumType enumeration class extending {@link java.lang.Enum} */ public static <E extends Enum<E>> TypeInformation<E> ENUM(Class<E> enumType) { return new EnumTypeInfo<>(enumType); }
Example #4
Source Project: flink Author: flink-tpc-ds File: Types.java License: Apache License 2.0 | 2 votes |
/** * Returns type information for Java enumerations. Null values are not supported. * * @param enumType enumeration class extending {@link java.lang.Enum} */ public static <E extends Enum<E>> TypeInformation<E> ENUM(Class<E> enumType) { return new EnumTypeInfo<>(enumType); }
Example #5
Source Project: flink Author: apache File: Types.java License: Apache License 2.0 | 2 votes |
/** * Returns type information for Java enumerations. Null values are not supported. * * @param enumType enumeration class extending {@link java.lang.Enum} */ public static <E extends Enum<E>> TypeInformation<E> ENUM(Class<E> enumType) { return new EnumTypeInfo<>(enumType); }