diff --git a/tsfile/src/main/java/org/apache/tsfile/read/filter/basic/ValueFilter.java b/tsfile/src/main/java/org/apache/tsfile/read/filter/basic/ValueFilter.java index 2fa8cba54..aba67d480 100644 --- a/tsfile/src/main/java/org/apache/tsfile/read/filter/basic/ValueFilter.java +++ b/tsfile/src/main/java/org/apache/tsfile/read/filter/basic/ValueFilter.java @@ -88,6 +88,10 @@ public boolean canSkip(IMetadata metadata) { @Override public boolean allSatisfy(IMetadata metadata) { + if (metadata.hasNullValue(measurementIndex)) { + // null not satisfy any filter, except IS NULL + return false; + } Optional> statistics = metadata.getMeasurementStatistics(measurementIndex); return statistics.map(this::allSatisfy).orElse(false); diff --git a/tsfile/src/main/java/org/apache/tsfile/read/filter/factory/ValueFilterApi.java b/tsfile/src/main/java/org/apache/tsfile/read/filter/factory/ValueFilterApi.java index fbed7326f..456b8ea2b 100644 --- a/tsfile/src/main/java/org/apache/tsfile/read/filter/factory/ValueFilterApi.java +++ b/tsfile/src/main/java/org/apache/tsfile/read/filter/factory/ValueFilterApi.java @@ -136,6 +136,10 @@ public static ValueRegexp like(int measurementIndex, String likePattern) { return regexp(measurementIndex, RegexUtils.parseLikePatternToRegex(likePattern)); } + public static ValueRegexp like(int measurementIndex, Pattern pattern) { + return regexp(measurementIndex, pattern); + } + public static ValueNotRegexp notLike(String likePattern) { return notRegexp(DEFAULT_MEASUREMENT_INDEX, RegexUtils.parseLikePatternToRegex(likePattern)); } @@ -144,6 +148,10 @@ public static ValueNotRegexp notLike(int measurementIndex, String likePattern) { return notRegexp(measurementIndex, RegexUtils.parseLikePatternToRegex(likePattern)); } + public static ValueNotRegexp notLike(int measurementIndex, Pattern pattern) { + return notRegexp(measurementIndex, pattern); + } + public static ValueRegexp regexp(String regex) { return new ValueRegexp(DEFAULT_MEASUREMENT_INDEX, RegexUtils.compileRegex(regex)); }