You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2019/05/14 04:28:41 UTC

[GitHub] [incubator-gobblin] htran1 commented on a change in pull request #2632: [GOBBLIN-769] Support string record timestamp in TimeBasedAvroWriterPartitioner

htran1 commented on a change in pull request #2632: [GOBBLIN-769] Support string record timestamp in TimeBasedAvroWriterPartitioner
URL: https://github.com/apache/incubator-gobblin/pull/2632#discussion_r283620840
 
 

 ##########
 File path: gobblin-core/src/main/java/org/apache/gobblin/writer/partitioner/TimeBasedAvroWriterPartitioner.java
 ##########
 @@ -73,9 +74,25 @@ public long getRecordTimestamp(GenericRecord record) {
   /**
    *  Check if the partition column value is present and is a Long object. Otherwise, use current system time.
    */
-  private static long getRecordTimestamp(Optional<Object> writerPartitionColumnValue) {
-    return writerPartitionColumnValue.orNull() instanceof Long ? (Long) writerPartitionColumnValue.get()
-        : System.currentTimeMillis();
+  private long getRecordTimestamp(Optional<Object> writerPartitionColumnValue) {
+
+    // Default to current time
+    Long recordTimestamp = timeUnit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
 
 Review comment:
   Should move this conversion after the if block and only do it when no value has been set to avoid the cost of get time and conversion.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services