juldrixx commented on a change in pull request #5014:
URL: https://github.com/apache/nifi/pull/5014#discussion_r672878946



##########
File path: 
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreaming.java
##########
@@ -191,6 +195,16 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
                     lmapr.add(convertMapRecord(((MapRecord) mapr).toMap()));
                 }
                 result.put(key, lmapr);
+            } else if (obj instanceof Timestamp) {
+                LocalDateTime dateTime = 
LocalDateTime.ofInstant(Instant.ofEpochMilli(((Timestamp) obj).getTime()), 
ZoneOffset.UTC);
+                DateTimeFormatter timestampFormatter = 
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
+                result.put(key, dateTime.format(timestampFormatter));
+            } else if (obj instanceof Time) {
+                LocalDateTime dateTime = 
LocalDateTime.ofInstant(Instant.ofEpochMilli(((Time) obj).getTime()), 
ZoneOffset.UTC);
+                DateTimeFormatter timeFormatter = 
DateTimeFormatter.ofPattern("HH:mm:ss.SSSSSS");
+                result.put(key, dateTime.format(timeFormatter) );

Review comment:
       Hi, I have already tried this method but it is dependent on the timezone 
in which the code is running for my part instead of having 12:35:24, it shows 
me 14:35:24.

##########
File path: 
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreaming.java
##########
@@ -191,6 +195,16 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
                     lmapr.add(convertMapRecord(((MapRecord) mapr).toMap()));
                 }
                 result.put(key, lmapr);
+            } else if (obj instanceof Timestamp) {
+                LocalDateTime dateTime = 
LocalDateTime.ofInstant(Instant.ofEpochMilli(((Timestamp) obj).getTime()), 
ZoneOffset.UTC);
+                DateTimeFormatter timestampFormatter = 
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
+                result.put(key, dateTime.format(timestampFormatter));

Review comment:
       Same reason as with Time, it is timezone dependent and comes out 
2021-07-18 14:35:24.




-- 
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]


Reply via email to