Skip to content

Commit

Permalink
IntColumnBuilder support write LocalDate Object
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpaulyz authored Nov 29, 2024
1 parent 0a4da54 commit 4a9eeaf
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 4a9eeaf

Please sign in to comment.