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 6a8e9449 Avoid invoke their max and min statistics function on the
Blob and TEXT type
6a8e9449 is described below
commit 6a8e94496d291aa7c34b11da8ff7d62b023f26f6
Author: libo <[email protected]>
AuthorDate: Sat Jan 3 08:20:41 2026 +0800
Avoid invoke their max and min statistics function on the Blob and TEXT type
---
.../codegen/templates/FilterOperatorsTemplate.ftl | 106 +++++++++++++++++++++
1 file changed, 106 insertions(+)
diff --git a/java/tsfile/src/main/codegen/templates/FilterOperatorsTemplate.ftl
b/java/tsfile/src/main/codegen/templates/FilterOperatorsTemplate.ftl
index fcd3bb01..8863481b 100644
--- a/java/tsfile/src/main/codegen/templates/FilterOperatorsTemplate.ftl
+++ b/java/tsfile/src/main/codegen/templates/FilterOperatorsTemplate.ftl
@@ -37,6 +37,10 @@ import org.apache.tsfile.common.regexp.LikePattern;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.exception.NotImplementedException;
import org.apache.tsfile.file.metadata.IMetadata;
+<#if filter.javaBoxName == "String">
+import org.apache.tsfile.file.metadata.statistics.BinaryStatistics;
+import org.apache.tsfile.file.metadata.statistics.BlobStatistics;
+</#if>
import org.apache.tsfile.file.metadata.statistics.Statistics;
import org.apache.tsfile.read.filter.basic.Filter;
import org.apache.tsfile.read.filter.basic.${filter.javaBoxName}Filter;
@@ -177,6 +181,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0
|| constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
@@ -199,6 +206,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0
|| constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
@@ -228,6 +238,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) == 0
&& constant.compareTo((${filter.dataType})
statistics.getMaxValue()) == 0;
@@ -244,6 +257,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) == 0
&& constant.compareTo((${filter.dataType})
statistics.getMaxValue()) == 0;
@@ -318,6 +334,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) == 0
&& constant.compareTo((${filter.dataType})
statistics.getMaxValue()) == 0;
@@ -334,6 +353,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) == 0
&& constant.compareTo((${filter.dataType})
statistics.getMaxValue()) == 0;
@@ -364,6 +386,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0
|| constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
@@ -380,6 +405,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0
|| constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
@@ -456,6 +484,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) <= 0;
}
@@ -470,6 +501,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary) {
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) <= 0;
}
@@ -497,6 +531,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
}
@@ -511,6 +548,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
}
@@ -584,6 +624,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0;
}
@@ -598,6 +641,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary) {
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0;
}
@@ -625,6 +671,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) >= 0;
}
@@ -639,6 +688,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) >= 0;
}
@@ -712,6 +764,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) >= 0;
}
@@ -726,6 +781,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary) {
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) >= 0;
}
@@ -753,6 +811,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0;
}
@@ -767,6 +828,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) < 0;
}
@@ -840,6 +904,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
}
@@ -854,6 +921,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMaxValue() instanceof Binary) {
return constant.compareTo((${filter.dataType})
statistics.getMaxValue()) > 0;
}
@@ -881,6 +951,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) <= 0;
}
@@ -895,6 +968,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if(statistics.getMinValue() instanceof Binary){
return constant.compareTo((${filter.dataType})
statistics.getMinValue()) <= 0;
}
@@ -1038,6 +1114,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMaxValue()).compareTo(min)
< 0
|| ((${filter.dataType}) statistics.getMinValue()).compareTo(max)
> 0;
@@ -1054,6 +1133,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMaxValue() instanceof Binary) &&
(statistics.getMinValue() instanceof Binary)) {
return ((${filter.dataType}) statistics.getMaxValue()).compareTo(min)
< 0
|| ((${filter.dataType}) statistics.getMinValue()).compareTo(max)
> 0;
@@ -1083,6 +1165,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMinValue()).compareTo(min)
>= 0
&& ((${filter.dataType}) statistics.getMaxValue()).compareTo(max)
<= 0;
@@ -1099,6 +1184,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMinValue()).compareTo(min)
>= 0
&& ((${filter.dataType}) statistics.getMaxValue()).compareTo(max)
<= 0;
@@ -1176,6 +1264,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMinValue()).compareTo(min)
>= 0
&& ((${filter.dataType}) statistics.getMaxValue()).compareTo(max)
<= 0;
@@ -1192,6 +1283,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)) {
return ((${filter.dataType}) statistics.getMinValue()).compareTo(min)
>= 0
&& ((${filter.dataType}) statistics.getMaxValue()).compareTo(max)
<= 0;
@@ -1221,6 +1315,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMinValue()).compareTo(max)
> 0
|| ((${filter.dataType}) statistics.getMaxValue()).compareTo(min)
< 0;
@@ -1237,6 +1334,9 @@ public final class ${className} {
if(statistics.isEmpty()){
return false;
}
+ if(statistics instanceof BlobStatistics || statistics instanceof
BinaryStatistics){
+ return false;
+ }
if((statistics.getMinValue() instanceof Binary) &&
(statistics.getMaxValue() instanceof Binary)){
return ((${filter.dataType}) statistics.getMinValue()).compareTo(max)
> 0
|| ((${filter.dataType}) statistics.getMaxValue()).compareTo(min)
< 0;
@@ -1427,6 +1527,9 @@ public final class ${className} {
<#if filter.dataType == "Binary" && filter.javaBoxName == "String">
${filter.dataType} valuesMin;
${filter.dataType} valuesMax;
+ if(stat instanceof BlobStatistics || stat instanceof BinaryStatistics){
+ return false;
+ }
if(stat.getMinValue() instanceof Binary){
valuesMin = (${filter.dataType}) stat.getMinValue();
}
@@ -1496,6 +1599,9 @@ public final class ${className} {
<#if filter.dataType == "Binary" && filter.javaBoxName == "String">
${filter.dataType} valuesMin;
${filter.dataType} valuesMax;
+ if(stat instanceof BlobStatistics || stat instanceof BinaryStatistics){
+ return false;
+ }
if(stat.getMinValue() instanceof Binary){
valuesMin = (${filter.dataType}) stat.getMinValue();
}