Skip to content

Commit

Permalink
Core: Fix CCE when retrieving TableOps (#11585)
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra authored Nov 20, 2024
1 parent 3c4a710 commit 918f81f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/main/java/org/apache/iceberg/SerializableTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ protected Table newTable(TableOperations ops, String tableName) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,6 +103,9 @@ public void testSerializableMetadataTable() throws IOException, ClassNotFoundExc
Table serializableTable = SerializableTable.copyOf(metadataTable);
TestHelpers.assertSerializedAndLoadedMetadata(
serializableTable, TestHelpers.KryoHelpers.roundTripSerialize(serializableTable));
assertThatThrownBy(() -> ((HasTableOperations) serializableTable).operations())
.isInstanceOf(UnsupportedOperationException.class)
.hasMessageEndingWith("does not support operations()");
}
}

Expand Down

0 comments on commit 918f81f

Please sign in to comment.