From 46d544357e95f8133478a2e80c0b22f035c206b3 Mon Sep 17 00:00:00 2001 From: Reetika Agrawal Date: Mon, 4 Dec 2023 19:26:20 +0530 Subject: [PATCH] Remove ref hash session property for Iceberg Nessie catalog --- .../presto/iceberg/IcebergResourceFactory.java | 7 ------- .../presto/iceberg/IcebergSessionProperties.java | 11 ----------- .../iceberg/nessie/TestNessieMultiBranching.java | 13 ------------- 3 files changed, 31 deletions(-) diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java index 97f59d5e31bcb..08648511dee85 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java @@ -35,7 +35,6 @@ import java.util.concurrent.ExecutionException; import static com.facebook.presto.iceberg.CatalogType.NESSIE; -import static com.facebook.presto.iceberg.IcebergSessionProperties.getNessieReferenceHash; import static com.facebook.presto.iceberg.IcebergSessionProperties.getNessieReferenceName; import static com.facebook.presto.iceberg.nessie.AuthenticationType.BASIC; import static com.facebook.presto.iceberg.nessie.AuthenticationType.BEARER; @@ -121,8 +120,6 @@ private String getCatalogCacheKey(ConnectorSession session) if (catalogType == NESSIE) { sb.append(getNessieReferenceName(session)); - sb.append("@"); - sb.append(getNessieReferenceHash(session)); } return sb.toString(); @@ -157,10 +154,6 @@ public Map getCatalogProperties(ConnectorSession session) if (catalogType == NESSIE) { properties.put("ref", getNessieReferenceName(session)); properties.put("uri", nessieConfig.getServerUri().orElseThrow(() -> new IllegalStateException("iceberg.nessie.uri must be set for Nessie"))); - String hash = getNessieReferenceHash(session); - if (hash != null) { - properties.put("ref.hash", hash); - } nessieConfig.getReadTimeoutMillis().ifPresent(val -> properties.put("transport.read-timeout", val.toString())); nessieConfig.getConnectTimeoutMillis().ifPresent(val -> properties.put("transport.connect-timeout", val.toString())); nessieConfig.getClientBuilderImpl().ifPresent(val -> properties.put("client-builder-impl", val)); diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSessionProperties.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSessionProperties.java index 1f7e7fb4d19c6..42d780365c6df 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSessionProperties.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSessionProperties.java @@ -77,7 +77,6 @@ public final class IcebergSessionProperties private static final String MINIMUM_ASSIGNED_SPLIT_WEIGHT = "minimum_assigned_split_weight"; private static final String NODE_SELECTION_STRATEGY = "node_selection_strategy"; private static final String NESSIE_REFERENCE_NAME = "nessie_reference_name"; - private static final String NESSIE_REFERENCE_HASH = "nessie_reference_hash"; public static final String READ_MASKED_VALUE_ENABLED = "read_null_masked_parquet_encrypted_value_enabled"; public static final String PARQUET_DEREFERENCE_PUSHDOWN_ENABLED = "parquet_dereference_pushdown_enabled"; public static final String MERGE_ON_READ_MODE_ENABLED = "merge_on_read_enabled"; @@ -275,11 +274,6 @@ public IcebergSessionProperties( "Nessie reference name to use", nessieConfig.getDefaultReferenceName(), false), - stringProperty( - NESSIE_REFERENCE_HASH, - "Nessie reference hash to use", - null, - false), booleanProperty( READ_MASKED_VALUE_ENABLED, "Return null when access is denied for an encrypted parquet column", @@ -458,11 +452,6 @@ public static String getNessieReferenceName(ConnectorSession session) return session.getProperty(NESSIE_REFERENCE_NAME, String.class); } - public static String getNessieReferenceHash(ConnectorSession session) - { - return session.getProperty(NESSIE_REFERENCE_HASH, String.class); - } - public static double getMinimumAssignedSplitWeight(ConnectorSession session) { return session.getProperty(MINIMUM_ASSIGNED_SPLIT_WEIGHT, Double.class); diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieMultiBranching.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieMultiBranching.java index 4ff896164702b..6a5c98322339f 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieMultiBranching.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieMultiBranching.java @@ -157,14 +157,6 @@ public void testTableDataVisibility() // retrieve the second to the last commit hash and query the table with that hash List logEntries = nessieApiV1.getCommitLog().refName(two.getName()).get().getLogEntries(); assertThat(logEntries).isNotEmpty(); - String hash = logEntries.get(1).getCommitMeta().getHash(); - Session sessionTwoAtHash = sessionOnRef(two.getName(), hash); - - // at this hash there were only 3 rows - assertThat(computeScalar(sessionTwoAtHash, "SELECT count(*) FROM namespace_one.tbl")).isEqualTo(3L); - rows = computeActual(sessionTwoAtHash, "SELECT * FROM namespace_one.tbl"); - assertThat(rows.getMaterializedRows()).hasSize(3); - assertEqualsIgnoreOrder(rows.getMaterializedRows(), resultBuilder(sessionTwoAtHash, rows.getTypes()).row(1).row(2).row(5).build().getMaterializedRows()); } private Session sessionOnRef(String reference) @@ -172,11 +164,6 @@ private Session sessionOnRef(String reference) return Session.builder(getSession()).setCatalogSessionProperty("iceberg", "nessie_reference_name", reference).build(); } - private Session sessionOnRef(String reference, String hash) - { - return Session.builder(getSession()).setCatalogSessionProperty("iceberg", "nessie_reference_name", reference).setCatalogSessionProperty("iceberg", "nessie_reference_hash", hash).build(); - } - private Reference createBranch(String branchName) throws NessieConflictException, NessieNotFoundException {