Skip to content
Merged
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
62 changes: 61 additions & 1 deletion java/tsfile/src/main/codegen/templates/FilterTemplate.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
</#if>
import org.apache.tsfile.utils.ReadWriteIOUtils;

Expand Down Expand Up @@ -66,6 +67,65 @@ public abstract class ${className} extends ValueFilter {
}
</#if>

<#if filter.dataType == "float">
@Override
public boolean satisfyInteger(long time, int value){
return satisfyFloat(time, value);
}
</#if>

<#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>

<#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));
}
</#if>
</#if>

@Override
public ClassSerializeId getClassSerializeId() {
return ${filter.classSerializeName};
Expand Down
Loading