meethngala commented on code in PR #3663: URL: https://github.com/apache/gobblin/pull/3663#discussion_r1146630887
########## gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergRegisterStep.java: ########## @@ -0,0 +1,55 @@ +/* + * 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.gobblin.data.management.copy.iceberg; + +import java.io.IOException; + +import org.apache.iceberg.TableMetadata; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import org.apache.gobblin.commit.CommitStep; + +/** + * {@link CommitStep} to perform Iceberg registration. + */ + +@Slf4j +@AllArgsConstructor +public class IcebergRegisterStep implements CommitStep { + + private final IcebergTable srcIcebergTable; + private final IcebergTable existingDestinationIcebergTable; + + @Override + public boolean isCompleted() throws IOException { + return false; + } + + @Override + public void execute() throws IOException { + TableMetadata destinationMetadata = null; + try { + destinationMetadata = this.existingDestinationIcebergTable.accessTableMetadata(); + } catch (IcebergTable.TableNotFoundException tnfe) { + log.warn("Destination TableMetadata doesn't exist because : {}" , tnfe); Review Comment: gotcha! Made the changes in my latest commit ########## gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergHiveCatalog.java: ########## @@ -51,7 +54,10 @@ public String getCatalogUri() { } @Override - protected TableOperations createTableOperations(TableIdentifier tableId) { + protected TableOperations createTableOperations(TableIdentifier tableId) throws IOException { + if (!hc.tableExists(tableId)) { + throw new IcebergTable.TableNotFoundException(tableId); + } Review Comment: I agree that we shouldn't prohibit users from creating a table if it doesn't already exist. I have added a method `tableAlreadyExists` in my latest commit inside the `IcebergCatalog` interface and let the underlying implementation handle the verification of the table's existence. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
