Java Code Examples for org.apache.flink.api.common.typeinfo.TypeHint#getTypeInfo()

The following examples show how to use org.apache.flink.api.common.typeinfo.TypeHint#getTypeInfo() . 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: QueryableStateClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a future holding the request result.
 * @param jobId                     JobID of the job the queryable state belongs to.
 * @param queryableStateName        Name under which the state is queryable.
 * @param key			            The key we are interested in.
 * @param keyTypeHint				A {@link TypeHint} used to extract the type of the key.
 * @param stateDescriptor			The {@link StateDescriptor} of the state we want to query.
 * @return Future holding the immutable {@link State} object containing the result.
 */
@PublicEvolving
public <K, S extends State, V> CompletableFuture<S> getKvState(
		final JobID jobId,
		final String queryableStateName,
		final K key,
		final TypeHint<K> keyTypeHint,
		final StateDescriptor<S, V> stateDescriptor) {

	Preconditions.checkNotNull(keyTypeHint);

	TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo();
	return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor);
}
 
Example 2
Source File: QueryableStateClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a future holding the request result.
 * @param jobId                     JobID of the job the queryable state belongs to.
 * @param queryableStateName        Name under which the state is queryable.
 * @param key			            The key we are interested in.
 * @param keyTypeHint				A {@link TypeHint} used to extract the type of the key.
 * @param stateDescriptor			The {@link StateDescriptor} of the state we want to query.
 * @return Future holding the immutable {@link State} object containing the result.
 */
@PublicEvolving
public <K, S extends State, V> CompletableFuture<S> getKvState(
		final JobID jobId,
		final String queryableStateName,
		final K key,
		final TypeHint<K> keyTypeHint,
		final StateDescriptor<S, V> stateDescriptor) {

	Preconditions.checkNotNull(keyTypeHint);

	TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo();
	return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor);
}
 
Example 3
Source File: QueryableStateClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a future holding the request result.
 * @param jobId                     JobID of the job the queryable state belongs to.
 * @param queryableStateName        Name under which the state is queryable.
 * @param key			            The key we are interested in.
 * @param keyTypeHint				A {@link TypeHint} used to extract the type of the key.
 * @param stateDescriptor			The {@link StateDescriptor} of the state we want to query.
 * @return Future holding the immutable {@link State} object containing the result.
 */
@PublicEvolving
public <K, S extends State, V> CompletableFuture<S> getKvState(
		final JobID jobId,
		final String queryableStateName,
		final K key,
		final TypeHint<K> keyTypeHint,
		final StateDescriptor<S, V> stateDescriptor) {

	Preconditions.checkNotNull(keyTypeHint);

	TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo();
	return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor);
}
 
Example 4
Source File: KeyedStateReader.java    From bravo with Apache License 2.0 4 votes vote down vote up
/**
 * Create a reader for reading the state key-value pairs for the given value
 * state name. The provided type info will be used to deserialize the state
 * (allowing possible optimizations)
 */
public static <K, V> KeyedStateReader<K, V, Tuple2<K, V>> forValueStateKVPairs(String stateName,
		TypeHint<Tuple2<K, V>> tupleTypeHint) {
	TupleTypeInfo<Tuple2<K, V>> tupleType = (TupleTypeInfo<Tuple2<K, V>>) tupleTypeHint.getTypeInfo();
	return forValueStateKVPairs(stateName, tupleType.getTypeAt(0), tupleType.getTypeAt(1));
}
 
Example 5
Source File: AbstractDeserializationSchema.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Creates an AbstractDeserializationSchema that returns the TypeInformation
 * indicated by the given type hint. This constructor is only necessary when creating a generic
 * implementation, see {@link AbstractDeserializationSchema Generic Use}.
 *
 * @param typeHint The TypeHint for the produced type.
 */
protected AbstractDeserializationSchema(TypeHint<T> typeHint) {
	checkNotNull(typeHint, "typeHint");
	this.type = typeHint.getTypeInfo();
}
 
Example 6
Source File: AbstractDeserializationSchema.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Creates an AbstractDeserializationSchema that returns the TypeInformation
 * indicated by the given type hint. This constructor is only necessary when creating a generic
 * implementation, see {@link AbstractDeserializationSchema Generic Use}.
 *
 * @param typeHint The TypeHint for the produced type.
 */
protected AbstractDeserializationSchema(TypeHint<T> typeHint) {
	checkNotNull(typeHint, "typeHint");
	this.type = typeHint.getTypeInfo();
}
 
Example 7
Source File: AbstractDeserializationSchema.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Creates an AbstractDeserializationSchema that returns the TypeInformation
 * indicated by the given type hint. This constructor is only necessary when creating a generic
 * implementation, see {@link AbstractDeserializationSchema Generic Use}.
 *
 * @param typeHint The TypeHint for the produced type.
 */
protected AbstractDeserializationSchema(TypeHint<T> typeHint) {
	checkNotNull(typeHint, "typeHint");
	this.type = typeHint.getTypeInfo();
}