This is an automated email from the ASF dual-hosted git repository. hui pushed a commit to branch lmh/extendFilter in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 9e6f3b297dfe472663ce0b16c2016701be8e420f Author: Minghui Liu <[email protected]> AuthorDate: Fri Dec 1 10:00:15 2023 +0800 fix canSkipOffsetByStatistics() --- .../read/reader/chunk/MemAlignedPageReader.java | 16 +++++++--------- .../iotdb/tsfile/read/reader/page/AlignedPageReader.java | 14 ++++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java index 0f3f9dbed61..00e6af75fe2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java @@ -130,21 +130,19 @@ public class MemAlignedPageReader implements IPageReader, IAlignedPageReader, IS return true; } - // For aligned series, When we only query some measurements under an aligned device, if any - // values of these queried measurements has the same value count as the time column, the - // timestamp will be selected. + // For aligned series, we can use statistics to skip OFFSET only when all times are selected. // NOTE: if we change the query semantic in the future for aligned series, we need to remove // this check here. long rowCount = getTimeStatistics().getCount(); - for (Statistics<? extends Serializable> vStatistics : getValueStatisticsList()) { - if (vStatistics != null && vStatistics.hasNullValue(rowCount)) { - return false; + for (Statistics<? extends Serializable> statistics : getValueStatisticsList()) { + if (statistics != null && !statistics.hasNullValue(rowCount)) { + // When there is any value page point number that is the same as the time page, + // it means that all timestamps in time page will be selected. + return true; } } - // When the number of points in all value pages is the same as that in the time page, it means - // that there is no null value, and all timestamps will be selected. - return true; + return false; } @Override diff --git a/iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/AlignedPageReader.java b/iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/AlignedPageReader.java index 1f3449fefa2..0e8ee616e7c 100644 --- a/iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/AlignedPageReader.java +++ b/iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/AlignedPageReader.java @@ -151,21 +151,19 @@ public class AlignedPageReader implements IPageReader, IAlignedPageReader, IStat return true; } - // For aligned series, When we only query some measurements under an aligned device, if any - // values of these queried measurements has the same value count as the time column, the - // timestamp will be selected. + // For aligned series, we can use statistics to skip OFFSET only when all times are selected. // NOTE: if we change the query semantic in the future for aligned series, we need to remove // this check here. long rowCount = getTimeStatistics().getCount(); for (Statistics<? extends Serializable> statistics : getValueStatisticsList()) { - if (statistics != null && statistics.hasNullValue(rowCount)) { - return false; + if (statistics != null && !statistics.hasNullValue(rowCount)) { + // When there is any value page point number that is the same as the time page, + // it means that all timestamps in time page will be selected. + return true; } } - // When the number of points in all value pages is the same as that in the time page, it means - // that there is no null value, and all timestamps will be selected. - return true; + return false; } public IPointReader getLazyPointReader() throws IOException {
