org.apache.flink.api.common.typeutils.base.EnumSerializer Java Examples
The following examples show how to use
org.apache.flink.api.common.typeutils.base.EnumSerializer.
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: MigrationUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Skips bytes corresponding to serialized states. In flink 1.6+ the states are no longer kept in state. */ static void skipSerializedStates(DataInputView in) throws IOException { TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE; TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class); TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class); final int noOfStates = in.readInt(); for (int i = 0; i < noOfStates; i++) { nameSerializer.deserialize(in); stateTypeSerializer.deserialize(in); } for (int i = 0; i < noOfStates; i++) { String srcName = nameSerializer.deserialize(in); int noOfTransitions = in.readInt(); for (int j = 0; j < noOfTransitions; j++) { String src = nameSerializer.deserialize(in); Preconditions.checkState(src.equals(srcName), "Source Edge names do not match (" + srcName + " - " + src + ")."); nameSerializer.deserialize(in); actionSerializer.deserialize(in); try { skipCondition(in); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } }
Example #2
Source File: MigrationUtils.java From flink with Apache License 2.0 | 5 votes |
/** * Skips bytes corresponding to serialized states. In flink 1.6+ the states are no longer kept in state. */ static void skipSerializedStates(DataInputView in) throws IOException { TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE; TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class); TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class); final int noOfStates = in.readInt(); for (int i = 0; i < noOfStates; i++) { nameSerializer.deserialize(in); stateTypeSerializer.deserialize(in); } for (int i = 0; i < noOfStates; i++) { String srcName = nameSerializer.deserialize(in); int noOfTransitions = in.readInt(); for (int j = 0; j < noOfTransitions; j++) { String src = nameSerializer.deserialize(in); Preconditions.checkState(src.equals(srcName), "Source Edge names do not match (" + srcName + " - " + src + ")."); nameSerializer.deserialize(in); actionSerializer.deserialize(in); try { skipCondition(in); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } }
Example #3
Source File: MigrationUtils.java From flink with Apache License 2.0 | 5 votes |
/** * Skips bytes corresponding to serialized states. In flink 1.6+ the states are no longer kept in state. */ static void skipSerializedStates(DataInputView in) throws IOException { TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE; TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class); TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class); final int noOfStates = in.readInt(); for (int i = 0; i < noOfStates; i++) { nameSerializer.deserialize(in); stateTypeSerializer.deserialize(in); } for (int i = 0; i < noOfStates; i++) { String srcName = nameSerializer.deserialize(in); int noOfTransitions = in.readInt(); for (int j = 0; j < noOfTransitions; j++) { String src = nameSerializer.deserialize(in); Preconditions.checkState(src.equals(srcName), "Source Edge names do not match (" + srcName + " - " + src + ")."); nameSerializer.deserialize(in); actionSerializer.deserialize(in); try { skipCondition(in); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } }
Example #4
Source File: EnumTypeInfo.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override @PublicEvolving public TypeSerializer<T> createSerializer(ExecutionConfig executionConfig) { return new EnumSerializer<T>(typeClass); }
Example #5
Source File: EnumTypeInfo.java From flink with Apache License 2.0 | 4 votes |
@Override @PublicEvolving public TypeSerializer<T> createSerializer(ExecutionConfig executionConfig) { return new EnumSerializer<T>(typeClass); }
Example #6
Source File: EnumTypeInfo.java From flink with Apache License 2.0 | 4 votes |
@Override @PublicEvolving public TypeSerializer<T> createSerializer(ExecutionConfig executionConfig) { return new EnumSerializer<T>(typeClass); }