Java Code Examples for org.apache.flink.api.common.functions.RuntimeContext#getState()

The following examples show how to use org.apache.flink.api.common.functions.RuntimeContext#getState() . 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: OuterJoinRecordStateViews.java    From flink with Apache License 2.0 5 votes vote down vote up
private JoinKeyContainsUniqueKey(RuntimeContext ctx, String stateName, BaseRowTypeInfo recordType, StateTtlConfig ttlConfig) {
	TupleTypeInfo<Tuple2<BaseRow, Integer>> valueTypeInfo = new TupleTypeInfo<>(recordType, Types.INT);
	ValueStateDescriptor<Tuple2<BaseRow, Integer>> recordStateDesc = new ValueStateDescriptor<>(
		stateName,
		valueTypeInfo);
	if (!ttlConfig.equals(StateTtlConfig.DISABLED)) {
		recordStateDesc.enableTimeToLive(ttlConfig);
	}
	this.recordState = ctx.getState(recordStateDesc);
	// the result records always not more than 1
	this.reusedRecordList = new ArrayList<>(1);
	this.reusedTupleList = new ArrayList<>(1);
}
 
Example 2
Source File: JoinRecordStateViews.java    From flink with Apache License 2.0 5 votes vote down vote up
private JoinKeyContainsUniqueKey(
		RuntimeContext ctx,
		String stateName,
		BaseRowTypeInfo recordType,
		StateTtlConfig ttlConfig) {
	ValueStateDescriptor<BaseRow> recordStateDesc = new ValueStateDescriptor<>(
		stateName,
		recordType);
	if (!ttlConfig.equals(StateTtlConfig.DISABLED)) {
		recordStateDesc.enableTimeToLive(ttlConfig);
	}
	this.recordState = ctx.getState(recordStateDesc);
	// the result records always not more than 1
	this.reusedList = new ArrayList<>(1);
}
 
Example 3
Source File: OuterJoinRecordStateViews.java    From flink with Apache License 2.0 5 votes vote down vote up
private JoinKeyContainsUniqueKey(RuntimeContext ctx, String stateName, RowDataTypeInfo recordType, StateTtlConfig ttlConfig) {
	TupleTypeInfo<Tuple2<RowData, Integer>> valueTypeInfo = new TupleTypeInfo<>(recordType, Types.INT);
	ValueStateDescriptor<Tuple2<RowData, Integer>> recordStateDesc = new ValueStateDescriptor<>(
		stateName,
		valueTypeInfo);
	if (ttlConfig.isEnabled()) {
		recordStateDesc.enableTimeToLive(ttlConfig);
	}
	this.recordState = ctx.getState(recordStateDesc);
	// the result records always not more than 1
	this.reusedRecordList = new ArrayList<>(1);
	this.reusedTupleList = new ArrayList<>(1);
}
 
Example 4
Source File: JoinRecordStateViews.java    From flink with Apache License 2.0 5 votes vote down vote up
private JoinKeyContainsUniqueKey(
		RuntimeContext ctx,
		String stateName,
		RowDataTypeInfo recordType,
		StateTtlConfig ttlConfig) {
	ValueStateDescriptor<RowData> recordStateDesc = new ValueStateDescriptor<>(
		stateName,
		recordType);
	if (ttlConfig.isEnabled()) {
		recordStateDesc.enableTimeToLive(ttlConfig);
	}
	this.recordState = ctx.getState(recordStateDesc);
	// the result records always not more than 1
	this.reusedList = new ArrayList<>(1);
}