shangxinli commented on a change in pull request #900:
URL: https://github.com/apache/parquet-mr/pull/900#discussion_r830652740



##########
File path: 
parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoMessageConverter.java
##########
@@ -427,6 +485,218 @@ public void addBinary(Binary binary) {
 
   }
 
+  final class ProtoTimestampConverter extends PrimitiveConverter {
+
+    final ParentValueContainer parent;
+    final LogicalTypeAnnotation.TimestampLogicalTypeAnnotation 
logicalTypeAnnotation;
+
+    public ProtoTimestampConverter(ParentValueContainer parent, 
LogicalTypeAnnotation.TimestampLogicalTypeAnnotation logicalTypeAnnotation) {
+      this.parent = parent;
+      this.logicalTypeAnnotation = logicalTypeAnnotation;
+    }
+
+    @Override
+    public void addLong(long value) {
+      switch (logicalTypeAnnotation.getUnit()) {
+        case MICROS:
+          parent.add(Timestamps.fromMicros(value));
+          break;
+        case MILLIS:
+          parent.add(Timestamps.fromMillis(value));
+          break;
+        case NANOS:
+          parent.add(Timestamps.fromNanos(value));
+          break;
+      }
+    }
+  }
+
+  final class ProtoDateConverter extends PrimitiveConverter {
+
+    final ParentValueContainer parent;
+
+    public ProtoDateConverter(ParentValueContainer parent) {
+      this.parent = parent;
+    }
+
+    @Override
+    public void addInt(int value) {
+      LocalDate localDate = LocalDate.ofEpochDay(value);
+      com.google.type.Date date = com.google.type.Date.newBuilder()

Review comment:
       Can we use import? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@parquet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to