From 4a9eeaf6a8183f2bcd6a59acdd1c6baf0af49952 Mon Sep 17 00:00:00 2001 From: Chen YZ <43774645+Cpaulyz@users.noreply.github.com> Date: Fri, 29 Nov 2024 12:11:27 +0800 Subject: [PATCH] IntColumnBuilder support write LocalDate Object --- .../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"); }