ZhanGHanG9991 commented on code in PR #7277:
URL: https://github.com/apache/iotdb/pull/7277#discussion_r966979494
##########
server/src/main/java/org/apache/iotdb/db/mpp/aggregation/FirstValueAccumulator.java:
##########
@@ -247,21 +264,38 @@ protected void updateIntFirstValue(int value, long
curTime) {
}
}
- protected int addLongInput(Column[] column, TimeRange timeRange) {
- int curPositionCount = column[0].getPositionCount();
- long curMinTime = timeRange.getMin();
- long curMaxTime = timeRange.getMax();
- for (int i = 0; i < curPositionCount; i++) {
- long curTime = column[0].getLong(i);
- if (curTime > curMaxTime || curTime < curMinTime) {
- return i;
+ protected int addLongInput(Column[] column, IWindow curWindow) {
+ int windowControlColumnIndex = curWindow.getControlColumnIndex();
+ int curPositionCount = column[windowControlColumnIndex].getPositionCount();
+
+ if (curWindow.isTimeWindow()) {
+ for (int i = 0; i < curPositionCount; i++) {
+ if (!curWindow.satisfy(column[windowControlColumnIndex], i)) {
+ return i;
+ }
+ curWindow.mergeOnePoint();
+ if (!column[1].isNull(i)) {
+ updateLongFirstValue(column[1].getLong(i), column[0].getLong(i));
+ return i;
+ }
}
- if (!column[1].isNull(i)) {
- updateLongFirstValue(column[1].getLong(i), curTime);
- return i;
+ } else {
+ for (int i = 0; i < curPositionCount; i++) {
+ if (!curWindow.satisfy(column[windowControlColumnIndex], i)) {
+ return i;
+ }
+ curWindow.mergeOnePoint();
+ if (!column[1].isNull(i)) {
+ // do not assign true to hasCandidateResult
+ if (column[0].getLong(i) < minTime) {
+ minTime = column[0].getLong(i);
+ firstValue.setLong(column[1].getLong(i));
+ }
Review Comment:
This method has also been used in method `addIntermediate` and
`addStatistics`, so I think we should not remove `hasCandidateResult = true;`
in `updateXXXFirstValue`.
--
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]