You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2022/10/12 07:23:37 UTC

[hop] branch master updated: HOP-4458 - Handle timestamps in BigQueryInput

This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 19e014c532 HOP-4458 - Handle timestamps in BigQueryInput
     new 317b193104 Merge pull request #1735 from fbarthez/HOP-4458
19e014c532 is described below

commit 19e014c53244cf55fe9c39fd5873727e7b1e0462
Author: Fabian Peters <fa...@mercadu.de>
AuthorDate: Tue Oct 11 18:37:08 2022 +0200

    HOP-4458 - Handle timestamps in BigQueryInput
---
 .../java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java
index 448a7452f8..35f9010d5d 100644
--- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java
+++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/core/fn/BQSchemaAndRecordToHopFn.java
@@ -34,6 +34,7 @@ import org.apache.hop.pipeline.Pipeline;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.List;
 
@@ -156,6 +157,10 @@ public class BQSchemaAndRecordToHopFn implements SerializableFunction<SchemaAndR
                 row[index] = simpleDateTimeFormat.parse(datetimeString);
               }
               break;
+            case IValueMeta.TYPE_TIMESTAMP:
+              // we get a nanoseconds value from BigQuery, so divide by 1000
+              row[index] = new Timestamp((Long) srcData / 1000);
+              break;
             default:
               throw new RuntimeException(
                   "Conversion from Avro JSON to Hop is not yet supported for Hop data type '"