rdblue commented on code in PR #7412:
URL: https://github.com/apache/iceberg/pull/7412#discussion_r1253623412


##########
gcp/src/main/java/org/apache/iceberg/gcp/biglake/BigLakeTableOperations.java:
##########
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.gcp.biglake;
+
+import com.google.api.gax.rpc.AbortedException;
+import com.google.cloud.bigquery.biglake.v1.HiveTableOptions;
+import com.google.cloud.bigquery.biglake.v1.HiveTableOptions.SerDeInfo;
+import com.google.cloud.bigquery.biglake.v1.HiveTableOptions.StorageDescriptor;
+import com.google.cloud.bigquery.biglake.v1.Table;
+import com.google.cloud.bigquery.biglake.v1.TableName;
+import java.util.Map;
+import org.apache.iceberg.BaseMetastoreTableOperations;
+import org.apache.iceberg.TableMetadata;
+import org.apache.iceberg.TableProperties;
+import org.apache.iceberg.exceptions.AlreadyExistsException;
+import org.apache.iceberg.exceptions.CommitFailedException;
+import org.apache.iceberg.exceptions.CommitStateUnknownException;
+import org.apache.iceberg.exceptions.NoSuchIcebergTableException;
+import org.apache.iceberg.exceptions.NoSuchTableException;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** Handles BigLake table operations. */
+public final class BigLakeTableOperations extends BaseMetastoreTableOperations 
{
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(BigLakeTableOperations.class);
+
+  private final BigLakeClient client;
+  private final FileIO fileIO;
+  private final TableName tableName;
+
+  BigLakeTableOperations(BigLakeClient client, FileIO fileIO, TableName 
tableName) {
+    this.client = client;
+    this.fileIO = fileIO;
+    this.tableName = tableName;
+  }
+
+  // The doRefresh method should provide implementation on how to get the 
metadata location
+  @Override
+  public void doRefresh() {
+    // Must default to null.
+    String metadataLocation = null;
+    try {
+      HiveTableOptions hiveOptions = 
client.getTable(tableName).getHiveOptions();
+      if (!hiveOptions.containsParameters(METADATA_LOCATION_PROP)) {
+        throw new NoSuchIcebergTableException(
+            "Table %s is not a valid Iceberg table, metadata location not 
found", tableName());
+      }
+
+      metadataLocation = 
hiveOptions.getParametersOrThrow(METADATA_LOCATION_PROP);
+    } catch (NoSuchTableException e) {
+      if (currentMetadataLocation() != null) {
+        // Re-throws the exception because the table must exist in this case.

Review Comment:
   This is handled in `refresh` that calls this method. I don't think you need 
it here.
   
   The Hive catalog has as similar catch, but it is to translate the exception 
to `NoSuchTableException`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to