[ 
https://issues.apache.org/jira/browse/PARQUET-2042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17570543#comment-17570543
 ] 

ASF GitHub Bot commented on PARQUET-2042:
-----------------------------------------

shangxinli commented on code in PR #900:
URL: https://github.com/apache/parquet-mr/pull/900#discussion_r928306582


##########
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:
   If there is no collision on the imports, we should use imports generally. 





> Unwrap common Protobuf wrappers and logical Timestamps, Date, TimeOfDay
> -----------------------------------------------------------------------
>
>                 Key: PARQUET-2042
>                 URL: https://issues.apache.org/jira/browse/PARQUET-2042
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-protobuf
>            Reporter: Michael Wong
>            Priority: Major
>
> Related to https://issues.apache.org/jira/browse/PARQUET-1595



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to