From a47b4792dc9bb793c5007f9ef421403ee870d6f2 Mon Sep 17 00:00:00 2001 From: Nero Date: Wed, 31 Dec 2025 09:34:28 +0800 Subject: [PATCH] Extend some satisfy functions in every data type corresponding Value Filter class so that accept other type as match object. --- .../main/codegen/templates/FilterTemplate.ftl | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/java/tsfile/src/main/codegen/templates/FilterTemplate.ftl b/java/tsfile/src/main/codegen/templates/FilterTemplate.ftl index e42a0bcae..34475facb 100644 --- a/java/tsfile/src/main/codegen/templates/FilterTemplate.ftl +++ b/java/tsfile/src/main/codegen/templates/FilterTemplate.ftl @@ -23,8 +23,9 @@ import static org.apache.tsfile.utils.ReadWriteIOUtils.ClassSerializeId.${filter import org.apache.tsfile.block.column.Column; import org.apache.tsfile.read.common.block.TsBlock; -<#if filter.dataType == "Binary"> +<#if filter.dataType == "Binary" || filter.dataType == "String"> import org.apache.tsfile.utils.Binary; +import java.nio.charset.StandardCharsets; import org.apache.tsfile.utils.ReadWriteIOUtils; @@ -66,6 +67,65 @@ public abstract class ${className} extends ValueFilter { } + <#if filter.dataType == "float"> + @Override + public boolean satisfyInteger(long time, int value){ + return satisfyFloat(time, value); + } + + + <#if filter.dataType == "double"> + @Override + public boolean satisfyInteger(long time, int value){ + return satisfyDouble(time, value); + } + + @Override + public boolean satisfyLong(long time, long value){ + return satisfyDouble(time, value); + } + + @Override + public boolean satisfyFloat(long time, float value){ + return satisfyDouble(time, value); + } + + + <#if filter.dataType == "String" || filter.dataType == "Binary"> + @Override + public boolean satisfyInteger(long time, int value){ + return satisfyBinary(time, new Binary(String.valueOf(value), StandardCharsets.UTF_8)); + } + + @Override + public boolean satisfyLong(long time, long value){ + return satisfyBinary(time, new Binary(String.valueOf(value), StandardCharsets.UTF_8)); + } + + @Override + public boolean satisfyFloat(long time, float value){ + return satisfyBinary(time, new Binary(String.valueOf(value), StandardCharsets.UTF_8)); + } + + @Override + public boolean satisfyDouble(long time, double value){ + return satisfyBinary(time, new Binary(String.valueOf(value), StandardCharsets.UTF_8)); + } + + @Override + public boolean satisfyBoolean(long time, boolean value){ + return satisfyBinary(time, new Binary(String.valueOf(value), StandardCharsets.UTF_8)); + } + + <#if filter.javaBoxName == "Tag"> + <#else> + @Override + public boolean satisfyString(long time, String value){ + return satisfyBinary(time, new Binary(value, StandardCharsets.UTF_8)); + } + + + @Override public ClassSerializeId getClassSerializeId() { return ${filter.classSerializeName};