You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by le...@apache.org on 2021/09/28 19:13:17 UTC

[gobblin] branch master updated: [GOBBLIN-1553] Catch exception when iceberg does not support get metrics for non-optional union type (#3405)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 81c81f6  [GOBBLIN-1553] Catch exception when iceberg does not support get metrics for non-optional union type (#3405)
81c81f6 is described below

commit 81c81f6ac0095d671eccaa80f7b20e69194dd8dc
Author: Zihan Li <zi...@linkedin.com>
AuthorDate: Tue Sep 28 12:13:12 2021 -0700

    [GOBBLIN-1553] Catch exception when iceberg does not support get metrics for non-optional union type (#3405)
    
    * [hotfix] workaround to catch exception when iceberg does not support get metrics for non-union type
    
    * address comments
---
 .../apache/gobblin/iceberg/publisher/GobblinMCEPublisher.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gobblin-iceberg/src/main/java/org/apache/gobblin/iceberg/publisher/GobblinMCEPublisher.java b/gobblin-iceberg/src/main/java/org/apache/gobblin/iceberg/publisher/GobblinMCEPublisher.java
index 0871fb7..8b76843 100644
--- a/gobblin-iceberg/src/main/java/org/apache/gobblin/iceberg/publisher/GobblinMCEPublisher.java
+++ b/gobblin-iceberg/src/main/java/org/apache/gobblin/iceberg/publisher/GobblinMCEPublisher.java
@@ -76,6 +76,7 @@ public class GobblinMCEPublisher extends DataPublisher {
   private final Closer closer = Closer.create();
   private final Configuration conf;
   private static final PathFilter HIDDEN_FILES_FILTER = new HiddenFilter();
+  private static final Metrics DUMMY_METRICS = new Metrics(100000000L, null, null, null, null);
 
   public GobblinMCEPublisher(State state) throws IOException {
 
@@ -196,9 +197,14 @@ public class GobblinMCEPublisher extends DataPublisher {
       case ORC: {
         if (mapping == null) {
           //This means the table is not compatible with iceberg, so return a dummy metric
-          return new Metrics(100000000L, null, null, null);
+          return DUMMY_METRICS;
+        }
+        try {
+          return OrcMetrics.fromInputFile(HadoopInputFile.fromPath(path, conf), MetricsConfig.getDefault(), mapping);
+        } catch (Exception e) {
+          //This means the table is not compatible with iceberg, so return a dummy metric
+          return DUMMY_METRICS;
         }
-        return OrcMetrics.fromInputFile(HadoopInputFile.fromPath(path, conf), MetricsConfig.getDefault(), mapping);
       }
       case AVRO: {
         try {