amaliujia commented on code in PR #5137:
URL: https://github.com/apache/calcite/pull/5137#discussion_r3721926219
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java:
##########
@@ -1173,21 +1181,26 @@ private void initialize() {
elements.add(inputEnumerator.current());
}
- Map<@Nullable Object, SortedMultiMap<Pair<Long, Long>, @Nullable
Object[]>> sessionKeyMap =
- new HashMap<>();
+ // The windows of each key are kept sorted by start time; the merge
+ // below only compares a window with the one that precedes it.
+ Map<@Nullable Object, NavigableMap<Pair<Long, Long>, List<@Nullable
Object[]>>>
+ sessionKeyMap = new HashMap<>();
for (@Nullable Object[] element : elements) {
- SortedMultiMap<Pair<Long, Long>, @Nullable Object[]> session =
- sessionKeyMap.computeIfAbsent(element[indexOfKeyColumn], k -> new
SortedMultiMap<>());
- Object watermark =
- requireNonNull(element[indexOfWatermarkedColumn],
- "element[indexOfWatermarkedColumn]");
+ Object watermark = element[indexOfWatermarkedColumn];
+ if (watermark == null) {
+ // A row without a timestamp belongs to no session, and window_start
Review Comment:
I do not remember if we should discard a row whose timestamp is null.
This is an important behavior question and if not define properly, becoming
incorrect result.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]