From 02bd63655869d41c6f2cfaa91f05dce792033464 Mon Sep 17 00:00:00 2001 From: Ivan Chesnov Date: Thu, 13 Feb 2025 18:47:10 +0200 Subject: [PATCH] DX-100503: missed classes --- .../java/org/apache/arrow/c/BufferImportTypeVisitor.java | 6 ++++++ java/c/src/main/java/org/apache/arrow/c/Format.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java b/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java index 150c11e41edff..3e19ebd2e8da1 100644 --- a/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java +++ b/java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java @@ -381,6 +381,12 @@ public List visit(ArrowType.Timestamp type) { maybeImportBitmap(type), importFixedBytes(type, 1, TimeStampVector.TYPE_WIDTH)); } + @Override + public List visit(ArrowType.TimestampWithPrecision type) { + return Arrays.asList( + maybeImportBitmap(type), importFixedBytes(type, 1, TimeStampVector.TYPE_WIDTH)); + } + @Override public List visit(ArrowType.Interval type) { switch (type.getUnit()) { diff --git a/java/c/src/main/java/org/apache/arrow/c/Format.java b/java/c/src/main/java/org/apache/arrow/c/Format.java index f77a555d18481..120e029988e8c 100644 --- a/java/c/src/main/java/org/apache/arrow/c/Format.java +++ b/java/c/src/main/java/org/apache/arrow/c/Format.java @@ -208,6 +208,12 @@ static String asString(ArrowType arrowType) { String timezone = type.getTimezone(); return String.format("%s:%s", format, timezone == null ? "" : timezone); } + case TimestampWithPrecision: + { + ArrowType.TimestampWithPrecision type = (ArrowType.TimestampWithPrecision) arrowType; + String timezone = type.getTimezone(); + return String.format("tsp:%s,%d", timezone == null ? "" : timezone, type.getPrecision()); + } case Union: ArrowType.Union type = (ArrowType.Union) arrowType; String typeIDs = @@ -360,6 +366,9 @@ private static ArrowType parseComplexFormat(String format, String payload) return new ArrowType.Timestamp(TimeUnit.MICROSECOND, payloadToTimezone(payload)); case "tsn": return new ArrowType.Timestamp(TimeUnit.NANOSECOND, payloadToTimezone(payload)); + case "tsp": + String[] parts = payload.split(","); + return new ArrowType.TimestampWithPrecision(Integer.parseInt(parts[1]), parts[0]); default: throw new UnsupportedOperationException( String.format("Format %s:%s is not supported", format, payload));