This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/develop by this push:
new b81f754e Return false when datatype is not comparable for InFilter.
b81f754e is described below
commit b81f754e398c8c221ee6d89c067006bf098fc837
Author: Zhihao Shen <[email protected]>
AuthorDate: Tue Jul 23 11:49:47 2024 +0800
Return false when datatype is not comparable for InFilter.
---
.../read/filter/operator/ValueFilterOperators.java | 49 ++++++++++++++--------
1 file changed, 31 insertions(+), 18 deletions(-)
diff --git
a/java/tsfile/src/main/java/org/apache/tsfile/read/filter/operator/ValueFilterOperators.java
b/java/tsfile/src/main/java/org/apache/tsfile/read/filter/operator/ValueFilterOperators.java
index 905c364b..2558b231 100644
---
a/java/tsfile/src/main/java/org/apache/tsfile/read/filter/operator/ValueFilterOperators.java
+++
b/java/tsfile/src/main/java/org/apache/tsfile/read/filter/operator/ValueFilterOperators.java
@@ -790,19 +790,22 @@ public final class ValueFilterOperators {
}
if (statistics.isPresent()) {
- T valuesMin = (T) statistics.get().getMinValue();
- T valuesMax = (T) statistics.get().getMaxValue();
- // All values are same
- if (valuesMin.compareTo(valuesMax) == 0) {
- return !candidates.contains(valuesMin);
- } else {
- if (candidates.size() != 0) {
- // All values are less than min, or greater than max
- if (candidatesMin.compareTo(valuesMax) > 0) {
- return true;
- }
- if (candidatesMax.compareTo(valuesMin) < 0) {
- return true;
+ Statistics<? extends Serializable> stat = statistics.get();
+ if (!statisticsNotAvailable(stat)) {
+ T valuesMin = (T) stat.getMinValue();
+ T valuesMax = (T) stat.getMaxValue();
+ // All values are same
+ if (valuesMin.compareTo(valuesMax) == 0) {
+ return !candidates.contains(valuesMin);
+ } else {
+ if (candidates.size() != 0) {
+ // All values are less than min, or greater than max
+ if (candidatesMin.compareTo(valuesMax) > 0) {
+ return true;
+ }
+ if (candidatesMax.compareTo(valuesMin) < 0) {
+ return true;
+ }
}
}
}
@@ -829,11 +832,14 @@ public final class ValueFilterOperators {
// All values are same
if (statistics.isPresent()) {
- T valuesMin = (T) statistics.get().getMinValue();
- T valuesMax = (T) statistics.get().getMaxValue();
- // All values are same
- if (valuesMin.compareTo(valuesMax) == 0) {
- return candidates.contains(valuesMin);
+ Statistics<? extends Serializable> stat = statistics.get();
+ if (!statisticsNotAvailable(stat)) {
+ T valuesMin = (T) stat.getMinValue();
+ T valuesMax = (T) stat.getMaxValue();
+ // All values are same
+ if (valuesMin.compareTo(valuesMax) == 0) {
+ return candidates.contains(valuesMin);
+ }
}
}
@@ -858,6 +864,13 @@ public final class ValueFilterOperators {
private boolean isAllNulls(Statistics<? extends Serializable> statistics) {
return statistics.getCount() == 0;
}
+
+ private static boolean statisticsNotAvailable(Statistics<?> statistics) {
+ return statistics.getType() == TSDataType.TEXT
+ || statistics.getType() == TSDataType.BOOLEAN
+ || statistics.getType() == TSDataType.BLOB
+ || statistics.isEmpty();
+ }
}
public static final class ValueNotIn<T extends Comparable<T>> extends
ValueColumnSetFilter<T> {