use of org.apache.flink.state.api.input.ListStateInputFormat in project flink by apache.
the class ExistingSavepoint method readListState.
/**
* Read operator {@code ListState} from a {@code Savepoint}.
*
* @param uid The uid of the operator.
* @param name The (unique) name for the state.
* @param typeInfo The type of the elements in the state.
* @param <T> The type of the values that are in the list state.
* @return A {@code DataSet} representing the elements in state.
* @throws IOException If the savepoint path is invalid or the uid does not exist.
*/
public <T> DataSource<T> readListState(String uid, String name, TypeInformation<T> typeInfo) throws IOException {
OperatorState operatorState = metadata.getOperatorState(uid);
ListStateDescriptor<T> descriptor = new ListStateDescriptor<>(name, typeInfo);
ListStateInputFormat<T> inputFormat = new ListStateInputFormat<>(operatorState, env.getConfiguration(), stateBackend, descriptor);
return env.createInput(inputFormat, typeInfo);
}
use of org.apache.flink.state.api.input.ListStateInputFormat in project flink by apache.
the class ExistingSavepoint method readListState.
/**
* Read operator {@code ListState} from a {@code Savepoint} when a custom serializer was used;
* e.g., a different serializer than the one returned by {@code
* TypeInformation#createSerializer}.
*
* @param uid The uid of the operator.
* @param name The (unique) name for the state.
* @param typeInfo The type of the elements in the state.
* @param serializer The serializer used to write the elements into state.
* @param <T> The type of the values that are in the list state.
* @return A {@code DataSet} representing the elements in state.
* @throws IOException If the savepoint path is invalid or the uid does not exist.
*/
public <T> DataSource<T> readListState(String uid, String name, TypeInformation<T> typeInfo, TypeSerializer<T> serializer) throws IOException {
OperatorState operatorState = metadata.getOperatorState(uid);
ListStateDescriptor<T> descriptor = new ListStateDescriptor<>(name, serializer);
ListStateInputFormat<T> inputFormat = new ListStateInputFormat<>(operatorState, env.getConfiguration(), stateBackend, descriptor);
return env.createInput(inputFormat, typeInfo);
}
use of org.apache.flink.state.api.input.ListStateInputFormat in project flink by apache.
the class SavepointReader method readListState.
/**
* Read operator {@code ListState} from a {@code Savepoint} when a custom serializer was used;
* e.g., a different serializer than the one returned by {@code
* TypeInformation#createSerializer}.
*
* @param uid The uid of the operator.
* @param name The (unique) name for the state.
* @param typeInfo The type of the elements in the state.
* @param serializer The serializer used to write the elements into state.
* @param <T> The type of the values that are in the list state.
* @return A {@code DataStream} representing the elements in state.
* @throws IOException If the savepoint path is invalid or the uid does not exist.
*/
public <T> DataStream<T> readListState(String uid, String name, TypeInformation<T> typeInfo, TypeSerializer<T> serializer) throws IOException {
OperatorState operatorState = metadata.getOperatorState(uid);
ListStateDescriptor<T> descriptor = new ListStateDescriptor<>(name, serializer);
ListStateInputFormat<T> inputFormat = new ListStateInputFormat<>(operatorState, MutableConfig.of(env.getConfiguration()), stateBackend, descriptor);
return SourceBuilder.fromFormat(env, inputFormat, typeInfo);
}
use of org.apache.flink.state.api.input.ListStateInputFormat in project flink by apache.
the class SavepointReader method readListState.
/**
* Read operator {@code ListState} from a {@code Savepoint}.
*
* @param uid The uid of the operator.
* @param name The (unique) name for the state.
* @param typeInfo The type of the elements in the state.
* @param <T> The type of the values that are in the list state.
* @return A {@code DataStream} representing the elements in state.
* @throws IOException If the savepoint path is invalid or the uid does not exist.
*/
public <T> DataStream<T> readListState(String uid, String name, TypeInformation<T> typeInfo) throws IOException {
OperatorState operatorState = metadata.getOperatorState(uid);
ListStateDescriptor<T> descriptor = new ListStateDescriptor<>(name, typeInfo);
ListStateInputFormat<T> inputFormat = new ListStateInputFormat<>(operatorState, MutableConfig.of(env.getConfiguration()), stateBackend, descriptor);
return SourceBuilder.fromFormat(env, inputFormat, typeInfo);
}
Aggregations