From a936bf93639f98a252ff319cd8e51398626fa62f Mon Sep 17 00:00:00 2001 From: Chen YZ Date: Fri, 29 Nov 2024 11:40:11 +0800 Subject: [PATCH] support write local date --- .../tsfile/read/common/block/column/IntColumnBuilder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/tsfile/src/main/java/org/apache/tsfile/read/common/block/column/IntColumnBuilder.java b/java/tsfile/src/main/java/org/apache/tsfile/read/common/block/column/IntColumnBuilder.java index e78eac1db..4148ad7bf 100644 --- a/java/tsfile/src/main/java/org/apache/tsfile/read/common/block/column/IntColumnBuilder.java +++ b/java/tsfile/src/main/java/org/apache/tsfile/read/common/block/column/IntColumnBuilder.java @@ -23,10 +23,12 @@ import org.apache.tsfile.block.column.ColumnBuilder; import org.apache.tsfile.block.column.ColumnBuilderStatus; import org.apache.tsfile.enums.TSDataType; +import org.apache.tsfile.utils.DateUtils; import org.apache.tsfile.utils.RamUsageEstimator; import org.apache.tsfile.utils.TsPrimitiveType; import org.apache.tsfile.write.UnSupportedDataTypeException; +import java.time.LocalDate; import java.util.Arrays; import static java.lang.Math.max; @@ -83,6 +85,9 @@ public ColumnBuilder writeObject(Object value) { if (value instanceof Integer) { writeInt((Integer) value); return this; + } else if (value instanceof LocalDate) { + writeInt(DateUtils.parseDateExpressionToInt((LocalDate) value)); + return this; } throw new UnSupportedDataTypeException("IntegerColumn only support Integer data type"); }