-
Notifications
You must be signed in to change notification settings - Fork 380
/
IcebergCatalogUtil.java
35 lines (30 loc) · 1.02 KB
/
IcebergCatalogUtil.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright 2023 Datastrato.
* This software is licensed under the Apache License version 2.
*/
package com.datastrato.graviton.catalog.lakehouse.iceberg.iceberg.utils;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.iceberg.catalog.Catalog;
import org.apache.iceberg.inmemory.InMemoryCatalog;
public class IcebergCatalogUtil {
private static InMemoryCatalog loadMemoryCatalog() {
InMemoryCatalog memoryCatalog = new InMemoryCatalog();
Map<String, String> properties = new HashMap<>();
memoryCatalog.initialize("memory", properties);
return memoryCatalog;
}
public static Catalog loadIcebergCatalog(String catalogType) {
switch (catalogType.toLowerCase(Locale.ENGLISH)) {
case "memory":
return loadMemoryCatalog();
// todo: add hive, jdbc catalog
default:
throw new RuntimeException(
catalogType
+ " catalog is not supported yet, supported catalogs: [memory]"
+ catalogType);
}
}
}