5353import org .apache .iceberg .io .FileIO ;
5454import org .apache .iceberg .relocated .com .google .common .base .Joiner ;
5555import org .apache .iceberg .relocated .com .google .common .collect .ImmutableMap ;
56+ import org .slf4j .Logger ;
57+ import org .slf4j .LoggerFactory ;
5658
5759/**
5860 * Nessie implementation of Iceberg Catalog.
6466 * </p>
6567 */
6668public class NessieCatalog extends BaseMetastoreCatalog implements AutoCloseable , SupportsNamespaces , Configurable {
67-
69+ private static final Logger logger = LoggerFactory . getLogger ( NessieCatalog . class );
6870 private static final Joiner SLASH = Joiner .on ("/" );
6971 public static final String NESSIE_WAREHOUSE_DIR = "nessie.warehouse.dir" ;
7072 private NessieClient client ;
@@ -74,9 +76,6 @@ public class NessieCatalog extends BaseMetastoreCatalog implements AutoCloseable
7476 private String name ;
7577 private FileIO fileIO ;
7678
77- /**
78- * Try to avoid passing parameters via hadoop config. Dynamic catalog expects Map instead
79- */
8079 public NessieCatalog () {
8180 }
8281
@@ -85,14 +84,13 @@ public void initialize(String inputName, Map<String, String> options) {
8584 String fileIOImpl = options .get (CatalogProperties .FILE_IO_IMPL );
8685 this .fileIO = fileIOImpl == null ? new HadoopFileIO (config ) : CatalogUtil .loadFileIO (fileIOImpl , options , config );
8786 this .name = inputName == null ? "nessie" : inputName ;
88- this .client = NessieClient .withConfig (s -> options . getOrDefault ( s , config . get ( s )) );
87+ this .client = NessieClient .withConfig (options :: get );
8988
90- this .warehouseLocation = options .getOrDefault ( NESSIE_WAREHOUSE_DIR , config . get (NESSIE_WAREHOUSE_DIR ) );
89+ this .warehouseLocation = options .get (NESSIE_WAREHOUSE_DIR );
9190 if (warehouseLocation == null ) {
9291 throw new IllegalStateException ("Parameter nessie.warehouse.dir not set, nessie can't store data." );
9392 }
94- final String requestedRef = options .getOrDefault (NessieClient .CONF_NESSIE_REF ,
95- config .get (NessieClient .CONF_NESSIE_REF ));
93+ final String requestedRef = options .get (NessieClient .CONF_NESSIE_REF );
9694 this .reference = loadReference (requestedRef );
9795 }
9896
@@ -148,11 +146,13 @@ public boolean dropTable(TableIdentifier identifier, boolean purge) {
148146 } catch (NessieConflictException e ) {
149147 // pass for retry
150148 } catch (NessieNotFoundException e ) {
151- throw new RuntimeException ("Cannot drop table: ref is no longer valid." , e );
149+ logger .error ("Cannot drop table: ref is no longer valid." , e );
150+ return false ;
152151 }
153152 }
154153 if (count >= 5 ) {
155- throw new RuntimeException ("Cannot drop table: failed after retry (update hash and retry)" );
154+ logger .error ("Cannot drop table: failed after retry (update hash and retry)" );
155+ return false ;
156156 }
157157 return true ;
158158 }
0 commit comments