mwong38 commented on a change in pull request #900:
URL: https://github.com/apache/parquet-mr/pull/900#discussion_r830941957
##########
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:
I think in this particular case it's more clear to be explicit that this
is the Google Protobuf Date, rather than, say, the Java built-in Date.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]