Java Code Examples for org.apache.flink.api.common.functions.RuntimeContext#getMapState()
The following examples show how to use
org.apache.flink.api.common.functions.RuntimeContext#getMapState() .
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 | 6 votes |
private InputSideHasUniqueKey( RuntimeContext ctx, String stateName, BaseRowTypeInfo recordType, BaseRowTypeInfo uniqueKeyType, KeySelector<BaseRow, BaseRow> uniqueKeySelector, StateTtlConfig ttlConfig) { checkNotNull(uniqueKeyType); checkNotNull(uniqueKeySelector); TupleTypeInfo<Tuple2<BaseRow, Integer>> valueTypeInfo = new TupleTypeInfo<>(recordType, Types.INT); MapStateDescriptor<BaseRow, Tuple2<BaseRow, Integer>> recordStateDesc = new MapStateDescriptor<>( stateName, uniqueKeyType, valueTypeInfo); if (!ttlConfig.equals(StateTtlConfig.DISABLED)) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); this.uniqueKeySelector = uniqueKeySelector; }
Example 2
Source File: JoinRecordStateViews.java From flink with Apache License 2.0 | 6 votes |
private InputSideHasUniqueKey( RuntimeContext ctx, String stateName, BaseRowTypeInfo recordType, BaseRowTypeInfo uniqueKeyType, KeySelector<BaseRow, BaseRow> uniqueKeySelector, StateTtlConfig ttlConfig) { checkNotNull(uniqueKeyType); checkNotNull(uniqueKeySelector); MapStateDescriptor<BaseRow, BaseRow> recordStateDesc = new MapStateDescriptor<>( stateName, uniqueKeyType, recordType); if (!ttlConfig.equals(StateTtlConfig.DISABLED)) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); this.uniqueKeySelector = uniqueKeySelector; }
Example 3
Source File: OuterJoinRecordStateViews.java From flink with Apache License 2.0 | 6 votes |
private InputSideHasUniqueKey( RuntimeContext ctx, String stateName, RowDataTypeInfo recordType, RowDataTypeInfo uniqueKeyType, KeySelector<RowData, RowData> uniqueKeySelector, StateTtlConfig ttlConfig) { checkNotNull(uniqueKeyType); checkNotNull(uniqueKeySelector); TupleTypeInfo<Tuple2<RowData, Integer>> valueTypeInfo = new TupleTypeInfo<>(recordType, Types.INT); MapStateDescriptor<RowData, Tuple2<RowData, Integer>> recordStateDesc = new MapStateDescriptor<>( stateName, uniqueKeyType, valueTypeInfo); if (ttlConfig.isEnabled()) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); this.uniqueKeySelector = uniqueKeySelector; }
Example 4
Source File: JoinRecordStateViews.java From flink with Apache License 2.0 | 6 votes |
private InputSideHasUniqueKey( RuntimeContext ctx, String stateName, RowDataTypeInfo recordType, RowDataTypeInfo uniqueKeyType, KeySelector<RowData, RowData> uniqueKeySelector, StateTtlConfig ttlConfig) { checkNotNull(uniqueKeyType); checkNotNull(uniqueKeySelector); MapStateDescriptor<RowData, RowData> recordStateDesc = new MapStateDescriptor<>( stateName, uniqueKeyType, recordType); if (ttlConfig.isEnabled()) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); this.uniqueKeySelector = uniqueKeySelector; }
Example 5
Source File: OuterJoinRecordStateViews.java From flink with Apache License 2.0 | 5 votes |
private InputSideHasNoUniqueKey( RuntimeContext ctx, String stateName, BaseRowTypeInfo recordType, StateTtlConfig ttlConfig) { TupleTypeInfo<Tuple2<Integer, Integer>> tupleTypeInfo = new TupleTypeInfo<>(Types.INT, Types.INT); MapStateDescriptor<BaseRow, Tuple2<Integer, Integer>> recordStateDesc = new MapStateDescriptor<>( stateName, recordType, tupleTypeInfo); if (!ttlConfig.equals(StateTtlConfig.DISABLED)) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); }
Example 6
Source File: JoinRecordStateViews.java From flink with Apache License 2.0 | 5 votes |
private InputSideHasNoUniqueKey( RuntimeContext ctx, String stateName, BaseRowTypeInfo recordType, StateTtlConfig ttlConfig) { MapStateDescriptor<BaseRow, Integer> recordStateDesc = new MapStateDescriptor<>( stateName, recordType, Types.INT); if (!ttlConfig.equals(StateTtlConfig.DISABLED)) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); }
Example 7
Source File: MultiplexedState.java From stateful-functions with Apache License 2.0 | 5 votes |
private static MapState<byte[], byte[]> createSharedMapState(RuntimeContext runtimeContext) { MapStateDescriptor<byte[], byte[]> descriptor = new MapStateDescriptor<>( "state", PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO, PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO); return runtimeContext.getMapState(descriptor); }
Example 8
Source File: SingleStreamSerialTransactor.java From da-streamingledger with Apache License 2.0 | 5 votes |
private static <K, V> MapState<K, V> fromSpec(StateAccessSpec<?, K, V> spec, RuntimeContext context) { MapStateDescriptor<K, V> descriptor = new MapStateDescriptor<>( spec.state.getName(), spec.state.getKeyType(), spec.state.getValueType()); return context.getMapState(descriptor); }
Example 9
Source File: OuterJoinRecordStateViews.java From flink with Apache License 2.0 | 5 votes |
private InputSideHasNoUniqueKey( RuntimeContext ctx, String stateName, RowDataTypeInfo recordType, StateTtlConfig ttlConfig) { TupleTypeInfo<Tuple2<Integer, Integer>> tupleTypeInfo = new TupleTypeInfo<>(Types.INT, Types.INT); MapStateDescriptor<RowData, Tuple2<Integer, Integer>> recordStateDesc = new MapStateDescriptor<>( stateName, recordType, tupleTypeInfo); if (ttlConfig.isEnabled()) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); }
Example 10
Source File: JoinRecordStateViews.java From flink with Apache License 2.0 | 5 votes |
private InputSideHasNoUniqueKey( RuntimeContext ctx, String stateName, RowDataTypeInfo recordType, StateTtlConfig ttlConfig) { MapStateDescriptor<RowData, Integer> recordStateDesc = new MapStateDescriptor<>( stateName, recordType, Types.INT); if (ttlConfig.isEnabled()) { recordStateDesc.enableTimeToLive(ttlConfig); } this.recordState = ctx.getMapState(recordStateDesc); }