Skip to content

Commit 49d6ae8

Browse files
authored
[lake/Iceberg] Support use type to load iceberg catalog (#1536)
1 parent 4cf486d commit 49d6ae8

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/IcebergLakeCatalog.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import static com.alibaba.fluss.metadata.TableDescriptor.BUCKET_COLUMN_NAME;
4949
import static com.alibaba.fluss.metadata.TableDescriptor.OFFSET_COLUMN_NAME;
5050
import static com.alibaba.fluss.metadata.TableDescriptor.TIMESTAMP_COLUMN_NAME;
51-
import static org.apache.iceberg.CatalogUtil.loadCatalog;
51+
import static org.apache.iceberg.CatalogUtil.buildIcebergCatalog;
5252

5353
/** An Iceberg implementation of {@link LakeCatalog}. */
5454
public class IcebergLakeCatalog implements LakeCatalog {
@@ -82,19 +82,10 @@ protected Catalog getIcebergCatalog() {
8282
private Catalog createIcebergCatalog(Configuration configuration) {
8383
Map<String, String> icebergProps = configuration.toMap();
8484

85-
String catalogType = icebergProps.get("type");
86-
if (catalogType == null) {
87-
throw new IllegalArgumentException(
88-
"Missing required Iceberg catalog type. Set 'iceberg.catalog.type' in your configuration (e.g., 'hive', 'hadoop', or 'rest').");
89-
}
90-
9185
String catalogName = icebergProps.getOrDefault("name", "fluss-iceberg-catalog");
9286

93-
return loadCatalog(
94-
catalogType,
95-
catalogName,
96-
icebergProps,
97-
null // Optional: pass Hadoop configuration if available
87+
return buildIcebergCatalog(
88+
catalogName, icebergProps, null // Optional: pass Hadoop configuration if available
9889
);
9990
}
10091

fluss-lake/fluss-lake-iceberg/src/test/java/com/alibaba/fluss/lake/iceberg/IcebergLakeCatalogTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class IcebergLakeCatalogTest {
5555
void setupCatalog() {
5656
Configuration configuration = new Configuration();
5757
configuration.setString("warehouse", tempWarehouseDir.toURI().toString());
58-
configuration.setString("type", "org.apache.iceberg.inmemory.InMemoryCatalog");
58+
configuration.setString("catalog-impl", "org.apache.iceberg.inmemory.InMemoryCatalog");
5959
configuration.setString("name", "fluss_test_catalog");
6060

6161
this.flussIcebergCatalog = new IcebergLakeCatalog(configuration);

0 commit comments

Comments
 (0)