Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions java/tsfile/src/main/codegen/templates/FilterOperatorsTemplate.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down
Loading