Java Code Examples for org.apache.flink.runtime.state.internal.InternalKvState#getSerializedValue()
The following examples show how to use
org.apache.flink.runtime.state.internal.InternalKvState#getSerializedValue() .
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: StateBackendTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ protected static <V, K, N> V getSerializedValue( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeValue(serializedValue, valueSerializer); } }
Example 2
Source File: StateBackendTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <V, K, N> List<V> getSerializedList( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeList(serializedValue, valueSerializer); } }
Example 3
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ protected static <V, K, N> V getSerializedValue( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeValue(serializedValue, valueSerializer); } }
Example 4
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <V, K, N> List<V> getSerializedList( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeList(serializedValue, valueSerializer); } }
Example 5
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ protected static <V, K, N> V getSerializedValue( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeValue(serializedValue, valueSerializer); } }
Example 6
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 6 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <V, K, N> List<V> getSerializedList( InternalKvState<K, N, V> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeList(serializedValue, valueSerializer); } }
Example 7
Source File: StateBackendTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <UK, UV, K, N> Map<UK, UV> getSerializedMap( InternalKvState<K, N, Map<UK, UV>> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<UK> userKeySerializer, TypeSerializer<UV> userValueSerializer ) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeMap(serializedValue, userKeySerializer, userValueSerializer); } }
Example 8
Source File: KvStateServerHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private static <K, N, V> byte[] getSerializedValue( final KvStateEntry<K, N, V> entry, final byte[] serializedKeyAndNamespace) throws Exception { final InternalKvState<K, N, V> state = entry.getState(); final KvStateInfo<K, N, V> infoForCurrentThread = entry.getInfoForCurrentThread(); return state.getSerializedValue( serializedKeyAndNamespace, infoForCurrentThread.getKeySerializer(), infoForCurrentThread.getNamespaceSerializer(), infoForCurrentThread.getStateValueSerializer() ); }
Example 9
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 5 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <UK, UV, K, N> Map<UK, UV> getSerializedMap( InternalKvState<K, N, Map<UK, UV>> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<UK> userKeySerializer, TypeSerializer<UV> userValueSerializer ) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeMap(serializedValue, userKeySerializer, userValueSerializer); } }
Example 10
Source File: KvStateServerHandler.java From flink with Apache License 2.0 | 5 votes |
private static <K, N, V> byte[] getSerializedValue( final KvStateEntry<K, N, V> entry, final byte[] serializedKeyAndNamespace) throws Exception { final InternalKvState<K, N, V> state = entry.getState(); final KvStateInfo<K, N, V> infoForCurrentThread = entry.getInfoForCurrentThread(); return state.getSerializedValue( serializedKeyAndNamespace, infoForCurrentThread.getKeySerializer(), infoForCurrentThread.getNamespaceSerializer(), infoForCurrentThread.getStateValueSerializer() ); }
Example 11
Source File: StateBackendTestBase.java From flink with Apache License 2.0 | 5 votes |
/** * Returns the value by getting the serialized value and deserializing it * if it is not null. */ private static <UK, UV, K, N> Map<UK, UV> getSerializedMap( InternalKvState<K, N, Map<UK, UV>> kvState, K key, TypeSerializer<K> keySerializer, N namespace, TypeSerializer<N> namespaceSerializer, TypeSerializer<UK> userKeySerializer, TypeSerializer<UV> userValueSerializer ) throws Exception { byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace( key, keySerializer, namespace, namespaceSerializer); byte[] serializedValue = kvState.getSerializedValue( serializedKeyAndNamespace, kvState.getKeySerializer(), kvState.getNamespaceSerializer(), kvState.getValueSerializer() ); if (serializedValue == null) { return null; } else { return KvStateSerializer.deserializeMap(serializedValue, userKeySerializer, userValueSerializer); } }
Example 12
Source File: KvStateServerHandler.java From flink with Apache License 2.0 | 5 votes |
private static <K, N, V> byte[] getSerializedValue( final KvStateEntry<K, N, V> entry, final byte[] serializedKeyAndNamespace) throws Exception { final InternalKvState<K, N, V> state = entry.getState(); final KvStateInfo<K, N, V> infoForCurrentThread = entry.getInfoForCurrentThread(); return state.getSerializedValue( serializedKeyAndNamespace, infoForCurrentThread.getKeySerializer(), infoForCurrentThread.getNamespaceSerializer(), infoForCurrentThread.getStateValueSerializer() ); }