bvarghese1 commented on code in PR #26424:
URL: https://github.com/apache/flink/pull/26424#discussion_r2184462794


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/over/AbstractNonTimeUnboundedPrecedingOver.java:
##########
@@ -0,0 +1,714 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.operators.over;
+
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.api.common.functions.OpenContext;
+import org.apache.flink.api.common.state.MapState;
+import org.apache.flink.api.common.state.MapStateDescriptor;
+import org.apache.flink.api.common.state.StateTtlConfig;
+import org.apache.flink.api.common.state.ValueState;
+import org.apache.flink.api.common.state.ValueStateDescriptor;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.api.java.functions.KeySelector;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.typeutils.ListTypeInfo;
+import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+import org.apache.flink.metrics.Counter;
+import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.utils.JoinedRowData;
+import org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore;
+import org.apache.flink.table.runtime.generated.AggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedAggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedRecordComparator;
+import org.apache.flink.table.runtime.generated.GeneratedRecordEqualiser;
+import org.apache.flink.table.runtime.generated.RecordEqualiser;
+import org.apache.flink.table.runtime.keyselector.RowDataKeySelector;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.types.RowKind;
+import org.apache.flink.util.Collector;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import static 
org.apache.flink.table.runtime.util.StateConfigUtil.createTtlConfig;
+
+/**
+ * The NonTimeRangeUnboundedPrecedingFunction class is a specialized 
implementation for processing
+ * unbounded OVER window aggregations, particularly for non-time-based range 
queries in Apache
+ * Flink. It maintains strict ordering of rows within partitions and handles 
the full changelog
+ * lifecycle (inserts, updates, deletes).
+ *
+ * <p>Key Components and Assumptions
+ *
+ * <p>Data Structure Design: (1) Maintains a sorted list of tuples containing 
sort keys and lists of
+ * IDs for each key (2) Each incoming row is assigned a unique Long ID 
(starting from
+ * Long.MIN_VALUE) (3) Uses multiple state types to track rows, sort orders, 
and aggregations
+ *
+ * <p>State Management: (1) idState: Counter for generating unique row IDs (2) 
sortedListState:
+ * Ordered list of sort keys with their associated row IDs (3) valueMapState: 
Maps IDs to their
+ * corresponding input rows (4) accMapState: Maps sort keys to their 
accumulated values
+ *
+ * <p>Processing Model: (1) For inserts/updates: Adds rows to the appropriate 
position based on sort
+ * key (2) For deletes: Removes rows by matching both sort key and row content 
(3) Recalculates
+ * aggregates for affected rows and emits the appropriate events (4) Skips 
redundant events when
+ * accumulators haven't changed to reduce network traffic
+ *
+ * <p>Optimization Assumptions: (1) Skip emitting updates when accumulators 
haven't changed to
+ * reduce network traffic (2) Uses state TTL for automatic cleanup of stale 
data (3) Carefully
+ * manages row state to support incremental calculations
+ *
+ * <p>Retraction Handling: (1) Handles retraction mode (DELETE/UPDATE_BEFORE) 
events properly (2)
+ * Supports the proper processing of changelog streams
+ *
+ * <p>Limitations
+ *
+ * <p>Linear search performance: - The current implementation uses a linear 
search to find the
+ * correct position for each sort key. This can be optimized using a binary 
search for large state
+ * sizes.
+ *
+ * <p>State size and performance: - The implementation maintains multiple 
state types that could
+ * grow large with high cardinality data
+ *
+ * <p>Linear recalculation: - When processing updates, all subsequent elements 
need to be
+ * recalculated, which could be inefficient for large windows
+ */
+public abstract class AbstractNonTimeUnboundedPrecedingOver<K>
+        extends KeyedProcessFunction<K, RowData, RowData> {
+    private static final long serialVersionUID = 1L;
+
+    private static final Logger LOG =
+            
LoggerFactory.getLogger(AbstractNonTimeUnboundedPrecedingOver.class);
+
+    private final long stateRetentionTime;
+
+    private final GeneratedAggsHandleFunction generatedAggsHandler;
+    private final GeneratedRecordEqualiser generatedRecordEqualiser;
+    private final GeneratedRecordEqualiser generatedSortKeyEqualiser;
+    private final GeneratedRecordComparator generatedSortKeyComparator;
+
+    // The util to compare two rows based on the sort attribute.
+    private transient Comparator<RowData> sortKeyComparator;
+
+    final KeySelector<RowData, RowData> sortKeySelector;
+    // The record equaliser used to equal RowData.
+    transient RecordEqualiser valueEqualiser;
+    private transient RecordEqualiser sortKeyEqualiser;
+
+    private final LogicalType[] accTypes;
+    private final LogicalType[] inputFieldTypes;
+    private final LogicalType[] sortKeyTypes;
+    transient JoinedRowData output;
+
+    private final InternalTypeInfo<RowData> accKeyRowTypeInfo;
+
+    // state to hold the Long ID counter
+    transient ValueState<Long> idState;
+    @VisibleForTesting transient ValueStateDescriptor<Long> idStateDescriptor;
+
+    // state to hold a sorted list each containing a tuple of sort key and 
list of IDs
+    transient ValueState<List<Tuple2<RowData, List<Long>>>> sortedListState;
+
+    @VisibleForTesting
+    transient ValueStateDescriptor<List<Tuple2<RowData, List<Long>>>> 
sortedListStateDescriptor;
+
+    // state to hold ID and its associated input row until state ttl expires
+    transient MapState<Long, RowData> valueMapState;
+    @VisibleForTesting transient MapStateDescriptor<Long, RowData> 
valueStateDescriptor;
+    // state to hold sortKey and its associated accumulator
+    transient MapState<RowData, RowData> accMapState;
+    @VisibleForTesting transient MapStateDescriptor<RowData, RowData> 
accStateDescriptor;
+
+    transient AggsHandleFunction aggFuncs;
+
+    // Metrics
+    private static final String IDS_NOT_FOUND_METRIC_NAME = "numOfIdsNotFound";
+    transient Counter numOfIdsNotFound;
+    private static final String SORT_KEYS_NOT_FOUND_METRIC_NAME = 
"numOfSortKeysNotFound";
+    transient Counter numOfSortKeysNotFound;
+
+    @VisibleForTesting
+    protected Counter getNumOfIdsNotFound() {
+        return numOfIdsNotFound;
+    }
+
+    @VisibleForTesting
+    protected Counter getNumOfSortKeysNotFound() {
+        return numOfSortKeysNotFound;
+    }
+
+    public AbstractNonTimeUnboundedPrecedingOver(
+            long stateRetentionTime,
+            GeneratedAggsHandleFunction genAggsHandler,
+            GeneratedRecordEqualiser genRecordEqualiser,
+            GeneratedRecordEqualiser genSortKeyEqualiser,
+            GeneratedRecordComparator genSortKeyComparator,
+            LogicalType[] accTypes,
+            LogicalType[] inputFieldTypes,
+            LogicalType[] sortKeyTypes,
+            RowDataKeySelector sortKeySelector,
+            InternalTypeInfo<RowData> accKeyRowTypeInfo) {
+        this.stateRetentionTime = stateRetentionTime;
+        this.generatedAggsHandler = genAggsHandler;
+        this.generatedRecordEqualiser = genRecordEqualiser;
+        this.generatedSortKeyEqualiser = genSortKeyEqualiser;
+        this.generatedSortKeyComparator = genSortKeyComparator;
+        this.accTypes = accTypes;
+        this.inputFieldTypes = inputFieldTypes;
+        this.sortKeyTypes = sortKeyTypes;
+        this.sortKeySelector = sortKeySelector;
+        this.accKeyRowTypeInfo = accKeyRowTypeInfo;
+    }
+
+    @Override
+    public void open(OpenContext openContext) throws Exception {
+        // Initialize agg functions
+        aggFuncs = 
generatedAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
+        aggFuncs.open(new PerKeyStateDataViewStore(getRuntimeContext()));
+
+        // Initialize output record
+        output = new JoinedRowData();
+
+        // Initialize value/row equaliser
+        valueEqualiser =
+                
generatedRecordEqualiser.newInstance(getRuntimeContext().getUserCodeClassLoader());
+
+        // Initialize sortKey equaliser
+        sortKeyEqualiser =
+                
generatedSortKeyEqualiser.newInstance(getRuntimeContext().getUserCodeClassLoader());
+
+        // Initialize sort comparator
+        sortKeyComparator =
+                generatedSortKeyComparator.newInstance(
+                        getRuntimeContext().getUserCodeClassLoader());
+
+        StateTtlConfig ttlConfig = createTtlConfig(stateRetentionTime);
+
+        // Initialize state to maintain id counter
+        idStateDescriptor = new ValueStateDescriptor<Long>("idState", 
Long.class);
+        if (ttlConfig.isEnabled()) {
+            idStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        idState = getRuntimeContext().getState(idStateDescriptor);
+
+        // Input elements are all binary rows as they came from network
+        InternalTypeInfo<RowData> inputRowTypeInfo = 
InternalTypeInfo.ofFields(inputFieldTypes);
+        InternalTypeInfo<RowData> sortKeyRowTypeInfo = 
InternalTypeInfo.ofFields(this.sortKeyTypes);
+
+        // Initialize state which maintains a sorted list of tuples(sortKey, 
List of IDs)
+        ListTypeInfo<Long> idListTypeInfo = new ListTypeInfo<Long>(Types.LONG);
+        ListTypeInfo<Tuple2<RowData, List<Long>>> listTypeInfo =
+                new ListTypeInfo<>(new TupleTypeInfo<>(sortKeyRowTypeInfo, 
idListTypeInfo));
+        sortedListStateDescriptor =
+                new ValueStateDescriptor<List<Tuple2<RowData, List<Long>>>>(
+                        "sortedListState", listTypeInfo);
+        if (ttlConfig.isEnabled()) {
+            sortedListStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        sortedListState = 
getRuntimeContext().getState(sortedListStateDescriptor);
+
+        // Initialize state which maintains the actual row
+        valueStateDescriptor =
+                new MapStateDescriptor<Long, RowData>(
+                        "valueMapState", Types.LONG, inputRowTypeInfo);
+        if (ttlConfig.isEnabled()) {
+            valueStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        valueMapState = getRuntimeContext().getMapState(valueStateDescriptor);
+
+        // Initialize accumulator state per row
+        InternalTypeInfo<RowData> accTypeInfo = 
InternalTypeInfo.ofFields(accTypes);
+        accStateDescriptor =
+                new MapStateDescriptor<RowData, RowData>(
+                        "accMapState", sortKeyRowTypeInfo, accTypeInfo);

Review Comment:
   Ah yes! that was my intention but somehow forgot to use the 
`accKeyRowTypeInfo`. 
   Updated the `AbstractNonTimeUnboundedPrecedingOver` code to use the 
`accKeyRowTypeInfo`.
   Also added a restore test to validate this 
`OVER_AGGREGATE_NON_TIME_ROWS_UNBOUNDED_SUM_RETRACT_MODE_SORT_BY_KEY`.



##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/over/AbstractNonTimeUnboundedPrecedingOver.java:
##########
@@ -0,0 +1,714 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.operators.over;
+
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.api.common.functions.OpenContext;
+import org.apache.flink.api.common.state.MapState;
+import org.apache.flink.api.common.state.MapStateDescriptor;
+import org.apache.flink.api.common.state.StateTtlConfig;
+import org.apache.flink.api.common.state.ValueState;
+import org.apache.flink.api.common.state.ValueStateDescriptor;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.api.java.functions.KeySelector;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.typeutils.ListTypeInfo;
+import org.apache.flink.api.java.typeutils.TupleTypeInfo;
+import org.apache.flink.metrics.Counter;
+import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.utils.JoinedRowData;
+import org.apache.flink.table.runtime.dataview.PerKeyStateDataViewStore;
+import org.apache.flink.table.runtime.generated.AggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedAggsHandleFunction;
+import org.apache.flink.table.runtime.generated.GeneratedRecordComparator;
+import org.apache.flink.table.runtime.generated.GeneratedRecordEqualiser;
+import org.apache.flink.table.runtime.generated.RecordEqualiser;
+import org.apache.flink.table.runtime.keyselector.RowDataKeySelector;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.types.RowKind;
+import org.apache.flink.util.Collector;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import static 
org.apache.flink.table.runtime.util.StateConfigUtil.createTtlConfig;
+
+/**
+ * The NonTimeRangeUnboundedPrecedingFunction class is a specialized 
implementation for processing
+ * unbounded OVER window aggregations, particularly for non-time-based range 
queries in Apache
+ * Flink. It maintains strict ordering of rows within partitions and handles 
the full changelog
+ * lifecycle (inserts, updates, deletes).
+ *
+ * <p>Key Components and Assumptions
+ *
+ * <p>Data Structure Design: (1) Maintains a sorted list of tuples containing 
sort keys and lists of
+ * IDs for each key (2) Each incoming row is assigned a unique Long ID 
(starting from
+ * Long.MIN_VALUE) (3) Uses multiple state types to track rows, sort orders, 
and aggregations
+ *
+ * <p>State Management: (1) idState: Counter for generating unique row IDs (2) 
sortedListState:
+ * Ordered list of sort keys with their associated row IDs (3) valueMapState: 
Maps IDs to their
+ * corresponding input rows (4) accMapState: Maps sort keys to their 
accumulated values
+ *
+ * <p>Processing Model: (1) For inserts/updates: Adds rows to the appropriate 
position based on sort
+ * key (2) For deletes: Removes rows by matching both sort key and row content 
(3) Recalculates
+ * aggregates for affected rows and emits the appropriate events (4) Skips 
redundant events when
+ * accumulators haven't changed to reduce network traffic
+ *
+ * <p>Optimization Assumptions: (1) Skip emitting updates when accumulators 
haven't changed to
+ * reduce network traffic (2) Uses state TTL for automatic cleanup of stale 
data (3) Carefully
+ * manages row state to support incremental calculations
+ *
+ * <p>Retraction Handling: (1) Handles retraction mode (DELETE/UPDATE_BEFORE) 
events properly (2)
+ * Supports the proper processing of changelog streams
+ *
+ * <p>Limitations
+ *
+ * <p>Linear search performance: - The current implementation uses a linear 
search to find the
+ * correct position for each sort key. This can be optimized using a binary 
search for large state
+ * sizes.
+ *
+ * <p>State size and performance: - The implementation maintains multiple 
state types that could
+ * grow large with high cardinality data
+ *
+ * <p>Linear recalculation: - When processing updates, all subsequent elements 
need to be
+ * recalculated, which could be inefficient for large windows
+ */
+public abstract class AbstractNonTimeUnboundedPrecedingOver<K>
+        extends KeyedProcessFunction<K, RowData, RowData> {
+    private static final long serialVersionUID = 1L;
+
+    private static final Logger LOG =
+            
LoggerFactory.getLogger(AbstractNonTimeUnboundedPrecedingOver.class);
+
+    private final long stateRetentionTime;
+
+    private final GeneratedAggsHandleFunction generatedAggsHandler;
+    private final GeneratedRecordEqualiser generatedRecordEqualiser;
+    private final GeneratedRecordEqualiser generatedSortKeyEqualiser;
+    private final GeneratedRecordComparator generatedSortKeyComparator;
+
+    // The util to compare two rows based on the sort attribute.
+    private transient Comparator<RowData> sortKeyComparator;
+
+    final KeySelector<RowData, RowData> sortKeySelector;
+    // The record equaliser used to equal RowData.
+    transient RecordEqualiser valueEqualiser;
+    private transient RecordEqualiser sortKeyEqualiser;
+
+    private final LogicalType[] accTypes;
+    private final LogicalType[] inputFieldTypes;
+    private final LogicalType[] sortKeyTypes;
+    transient JoinedRowData output;
+
+    private final InternalTypeInfo<RowData> accKeyRowTypeInfo;
+
+    // state to hold the Long ID counter
+    transient ValueState<Long> idState;
+    @VisibleForTesting transient ValueStateDescriptor<Long> idStateDescriptor;
+
+    // state to hold a sorted list each containing a tuple of sort key and 
list of IDs
+    transient ValueState<List<Tuple2<RowData, List<Long>>>> sortedListState;
+
+    @VisibleForTesting
+    transient ValueStateDescriptor<List<Tuple2<RowData, List<Long>>>> 
sortedListStateDescriptor;
+
+    // state to hold ID and its associated input row until state ttl expires
+    transient MapState<Long, RowData> valueMapState;
+    @VisibleForTesting transient MapStateDescriptor<Long, RowData> 
valueStateDescriptor;
+    // state to hold sortKey and its associated accumulator
+    transient MapState<RowData, RowData> accMapState;
+    @VisibleForTesting transient MapStateDescriptor<RowData, RowData> 
accStateDescriptor;
+
+    transient AggsHandleFunction aggFuncs;
+
+    // Metrics
+    private static final String IDS_NOT_FOUND_METRIC_NAME = "numOfIdsNotFound";
+    transient Counter numOfIdsNotFound;
+    private static final String SORT_KEYS_NOT_FOUND_METRIC_NAME = 
"numOfSortKeysNotFound";
+    transient Counter numOfSortKeysNotFound;
+
+    @VisibleForTesting
+    protected Counter getNumOfIdsNotFound() {
+        return numOfIdsNotFound;
+    }
+
+    @VisibleForTesting
+    protected Counter getNumOfSortKeysNotFound() {
+        return numOfSortKeysNotFound;
+    }
+
+    public AbstractNonTimeUnboundedPrecedingOver(
+            long stateRetentionTime,
+            GeneratedAggsHandleFunction genAggsHandler,
+            GeneratedRecordEqualiser genRecordEqualiser,
+            GeneratedRecordEqualiser genSortKeyEqualiser,
+            GeneratedRecordComparator genSortKeyComparator,
+            LogicalType[] accTypes,
+            LogicalType[] inputFieldTypes,
+            LogicalType[] sortKeyTypes,
+            RowDataKeySelector sortKeySelector,
+            InternalTypeInfo<RowData> accKeyRowTypeInfo) {
+        this.stateRetentionTime = stateRetentionTime;
+        this.generatedAggsHandler = genAggsHandler;
+        this.generatedRecordEqualiser = genRecordEqualiser;
+        this.generatedSortKeyEqualiser = genSortKeyEqualiser;
+        this.generatedSortKeyComparator = genSortKeyComparator;
+        this.accTypes = accTypes;
+        this.inputFieldTypes = inputFieldTypes;
+        this.sortKeyTypes = sortKeyTypes;
+        this.sortKeySelector = sortKeySelector;
+        this.accKeyRowTypeInfo = accKeyRowTypeInfo;
+    }
+
+    @Override
+    public void open(OpenContext openContext) throws Exception {
+        // Initialize agg functions
+        aggFuncs = 
generatedAggsHandler.newInstance(getRuntimeContext().getUserCodeClassLoader());
+        aggFuncs.open(new PerKeyStateDataViewStore(getRuntimeContext()));
+
+        // Initialize output record
+        output = new JoinedRowData();
+
+        // Initialize value/row equaliser
+        valueEqualiser =
+                
generatedRecordEqualiser.newInstance(getRuntimeContext().getUserCodeClassLoader());
+
+        // Initialize sortKey equaliser
+        sortKeyEqualiser =
+                
generatedSortKeyEqualiser.newInstance(getRuntimeContext().getUserCodeClassLoader());
+
+        // Initialize sort comparator
+        sortKeyComparator =
+                generatedSortKeyComparator.newInstance(
+                        getRuntimeContext().getUserCodeClassLoader());
+
+        StateTtlConfig ttlConfig = createTtlConfig(stateRetentionTime);
+
+        // Initialize state to maintain id counter
+        idStateDescriptor = new ValueStateDescriptor<Long>("idState", 
Long.class);
+        if (ttlConfig.isEnabled()) {
+            idStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        idState = getRuntimeContext().getState(idStateDescriptor);
+
+        // Input elements are all binary rows as they came from network
+        InternalTypeInfo<RowData> inputRowTypeInfo = 
InternalTypeInfo.ofFields(inputFieldTypes);
+        InternalTypeInfo<RowData> sortKeyRowTypeInfo = 
InternalTypeInfo.ofFields(this.sortKeyTypes);
+
+        // Initialize state which maintains a sorted list of tuples(sortKey, 
List of IDs)
+        ListTypeInfo<Long> idListTypeInfo = new ListTypeInfo<Long>(Types.LONG);
+        ListTypeInfo<Tuple2<RowData, List<Long>>> listTypeInfo =
+                new ListTypeInfo<>(new TupleTypeInfo<>(sortKeyRowTypeInfo, 
idListTypeInfo));
+        sortedListStateDescriptor =
+                new ValueStateDescriptor<List<Tuple2<RowData, List<Long>>>>(
+                        "sortedListState", listTypeInfo);
+        if (ttlConfig.isEnabled()) {
+            sortedListStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        sortedListState = 
getRuntimeContext().getState(sortedListStateDescriptor);
+
+        // Initialize state which maintains the actual row
+        valueStateDescriptor =
+                new MapStateDescriptor<Long, RowData>(
+                        "valueMapState", Types.LONG, inputRowTypeInfo);
+        if (ttlConfig.isEnabled()) {
+            valueStateDescriptor.enableTimeToLive(ttlConfig);
+        }
+        valueMapState = getRuntimeContext().getMapState(valueStateDescriptor);
+
+        // Initialize accumulator state per row
+        InternalTypeInfo<RowData> accTypeInfo = 
InternalTypeInfo.ofFields(accTypes);
+        accStateDescriptor =
+                new MapStateDescriptor<RowData, RowData>(
+                        "accMapState", sortKeyRowTypeInfo, accTypeInfo);

Review Comment:
   Thanks for catching this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to