Copilot commented on code in PR #16246:
URL: https://github.com/apache/iotdb/pull/16246#discussion_r2302732382
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java:
##########
@@ -1346,6 +1448,131 @@ public void setLimitOffset(PaginationController
paginationController) {
}
}
+ protected static class LazyMemVersionPageReader implements
IVersionPageReader {
+
+ private final Statistics<? extends Serializable> statistics;
+ private final MemPointIterator memPointIterator;
+ protected final QueryContext context;
+ protected final MergeReaderPriority version;
+
+ protected final boolean isSeq;
+ protected final boolean isAligned;
+ private boolean inited = false;
+
+ LazyMemVersionPageReader(
+ QueryContext context,
+ long fileTimestamp,
+ long version,
+ long offset,
+ boolean isAligned,
+ Statistics<? extends Serializable> statistics,
+ MemPointIterator memPointIterator,
+ boolean isSeq) {
+ this.statistics = statistics;
+ this.memPointIterator = memPointIterator;
+ this.context = context;
+ this.version = new MergeReaderPriority(fileTimestamp, version, offset,
isSeq);
+ this.isSeq = isSeq;
+ this.isAligned = isAligned;
+ }
+
+ public IPointReader getPointReader() {
+ return memPointIterator;
+ }
+
+ public boolean hasNextBatch() {
+ return memPointIterator.hasNextBatch();
+ }
+
+ public void setCurrentPageTimeRangeToMemPointIterator() {
+ if (inited) {
+ return;
+ }
+ if (statistics.getStartTime() > statistics.getEndTime()) {
+ // empty
+ return;
+ }
+ this.memPointIterator.setCurrentPageTimeRange(
+ new TimeRange(statistics.getStartTime(), statistics.getEndTime()));
+ }
+
+ public TsBlock nextBatch() {
+ long startTime = System.nanoTime();
+ try {
+ return memPointIterator.nextBatch();
+ } finally {
+ long time = System.nanoTime() - startTime;
+ if (isAligned) {
+
context.getQueryStatistics().getPageReadersDecodeAlignedMemCount().getAndAdd(1);
+
context.getQueryStatistics().getPageReadersDecodeAlignedMemTime().getAndAdd(time);
+ } else {
+
context.getQueryStatistics().getPageReadersDecodeAlignedMemCount().getAndAdd(1);
+
context.getQueryStatistics().getPageReadersDecodeNonAlignedMemTime().getAndAdd(time);
+ }
+ }
+ }
+
+ @Override
+ public Statistics getStatistics() {
+ return statistics;
+ }
+
+ @Override
+ public Statistics getMeasurementStatistics(int index) {
+ return statistics;
+ }
+
+ @Override
+ public Statistics getTimeStatistics() {
+ return statistics;
+ }
+
+ @Override
+ public TsBlock getAllSatisfiedPageData(boolean ascending) {
+ throw new UnsupportedOperationException("getAllSatisfiedPageData()
shouldn't be called here");
+ }
+
+ @Override
+ public MergeReaderPriority getVersion() {
+ return version;
+ }
+
+ @Override
+ public IPageReader getPageReader() {
+ throw new UnsupportedOperationException("getPageReader() shouldn't be
called here");
+ }
+
+ @Override
+ public void addPushDownFilter(Filter pushDownFilter) {
+ if (inited) {
+ return;
+ }
+ memPointIterator.setPushDownFilter(pushDownFilter);
+ }
+
+ @Override
+ public void setLimitOffset(PaginationController paginationController) {
+ if (inited) {
+ return;
+ }
+ memPointIterator.setLimitAndOffset(paginationController);
+ }
+
+ @Override
+ public boolean isModified() {
+ return true;
+ }
+
+ @Override
+ public boolean isSeq() {
Review Comment:
The LazyMemVersionPageReader.isSeq() method always returns false, but it
should return the actual isSeq value passed in the constructor. This could
cause incorrect behavior in sequence/unsequence file handling.
--
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]