You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by et...@apache.org on 2024/11/20 14:06:39 UTC

(iceberg) branch main updated: Core: Fix CCE when retrieving TableOps (#11585)

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

etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new 918f81f3c3 Core: Fix CCE when retrieving TableOps (#11585)
918f81f3c3 is described below

commit 918f81f3c3f498f46afcea17c1ac9cdc6913cb5c
Author: Eduard Tudenhoefner <et...@gmail.com>
AuthorDate: Wed Nov 20 15:06:33 2024 +0100

    Core: Fix CCE when retrieving TableOps (#11585)
---
 core/src/main/java/org/apache/iceberg/SerializableTable.java        | 6 ++++++
 .../test/java/org/apache/iceberg/hadoop/TestTableSerialization.java | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/core/src/main/java/org/apache/iceberg/SerializableTable.java b/core/src/main/java/org/apache/iceberg/SerializableTable.java
index 082e50b840..a2c0d77642 100644
--- a/core/src/main/java/org/apache/iceberg/SerializableTable.java
+++ b/core/src/main/java/org/apache/iceberg/SerializableTable.java
@@ -422,6 +422,12 @@ public class SerializableTable implements Table, HasTableOperations, Serializabl
       return MetadataTableUtils.createMetadataTableInstance(ops, baseTableName, tableName, type);
     }
 
+    @Override
+    public StaticTableOperations operations() {
+      throw new UnsupportedOperationException(
+          this.getClass().getName() + " does not support operations()");
+    }
+
     public MetadataTableType type() {
       return type;
     }
diff --git a/core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java b/core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java
index a24c4245b1..5ef4697b47 100644
--- a/core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java
+++ b/core/src/test/java/org/apache/iceberg/hadoop/TestTableSerialization.java
@@ -19,6 +19,7 @@
 package org.apache.iceberg.hadoop;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -102,6 +103,9 @@ public class TestTableSerialization extends HadoopTableTestBase {
       Table serializableTable = SerializableTable.copyOf(metadataTable);
       TestHelpers.assertSerializedAndLoadedMetadata(
           serializableTable, TestHelpers.KryoHelpers.roundTripSerialize(serializableTable));
+      assertThatThrownBy(() -> ((HasTableOperations) serializableTable).operations())
+          .isInstanceOf(UnsupportedOperationException.class)
+          .hasMessageEndingWith("does not support operations()");
     }
   }