Alima777 commented on a change in pull request #2859:
URL: https://github.com/apache/iotdb/pull/2859#discussion_r595972750
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/reader/chunk/DiskChunkReaderByTimestamp.java
##########
@@ -34,46 +34,49 @@
private ChunkReaderByTimestamp chunkReaderByTimestamp;
private BatchData data;
+ private long currentTime = Long.MIN_VALUE;
public DiskChunkReaderByTimestamp(ChunkReaderByTimestamp
chunkReaderByTimestamp) {
this.chunkReaderByTimestamp = chunkReaderByTimestamp;
}
@Override
- public Object getValueInTimestamp(long timestamp) throws IOException {
+ public Object[] getValuesInTimestamps(long[] timestamps, int length) throws
IOException {
+ Object[] result = new Object[length];
- if (!hasNext()) {
- return null;
- }
-
- while (data != null) {
- Object value = data.getValueInTimestamp(timestamp);
- if (value != null) {
- return value;
+ for (int i = 0; i < length; i++) {
+ if (timestamps[i] < currentTime) {
+ throw new IOException("time must be increasing when use
ReaderByTimestamp");
}
- if (data.hasCurrent()) {
- return null;
- } else {
- chunkReaderByTimestamp.setCurrentTimestamp(timestamp);
- if (chunkReaderByTimestamp.hasNextSatisfiedPage()) {
- data = chunkReaderByTimestamp.nextPageData();
- } else {
- return null;
+ currentTime = timestamps[i];
+ while (hasNext()) {
+ data = next();
+ if (data.getMaxTimestamp() > currentTime) {
+ result[i] = null;
+ break;
+ }
Review comment:
Fixed
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]