>From Hussain Towaileb <[email protected]>:
Hussain Towaileb has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20949?usp=email )
Change subject: [NO ISSUE][EXT]: Refactor iceberg code
......................................................................
[NO ISSUE][EXT]: Refactor iceberg code
Change-Id: I99e48e51ac2081fc899d89bcbc22f3f00ee072e6
---
M
asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/iceberg/IcebergUtils.java
1 file changed, 36 insertions(+), 0 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/49/20949/1
diff --git
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/iceberg/IcebergUtils.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/iceberg/IcebergUtils.java
index 20b5781..69480c8 100644
---
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/iceberg/IcebergUtils.java
+++
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/iceberg/IcebergUtils.java
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -56,6 +57,7 @@
import org.apache.iceberg.catalog.Catalog;
import org.apache.iceberg.catalog.Namespace;
import org.apache.iceberg.catalog.SupportsNamespaces;
+import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.nessie.NessieCatalog;
import org.apache.iceberg.rest.RESTCatalog;
import org.apache.logging.log4j.LogManager;
@@ -396,4 +398,38 @@
addTo.putIfAbsent(ICEBERG_CATALOG_PROPERTY_PREFIX_INTERNAL +
entry.getKey(), entry.getValue());
}
}
+
+ public static List<Namespace> listNamespaces(Catalog catalog,
CatalogConfig.IcebergCatalogSource source) {
+ return switch (source) {
+ case AWS_GLUE -> {
+ GlueCatalog glueCatalog = (GlueCatalog) catalog;
+ yield glueCatalog.listNamespaces();
+ }
+ case REST, AWS_GLUE_REST, BIGLAKE_METASTORE, S3_TABLES,
NESSIE_REST -> {
+ RESTCatalog restCatalog = (RESTCatalog) catalog;
+ yield restCatalog.listNamespaces();
+ }
+ case NESSIE -> {
+ NessieCatalog nessieCatalog = (NessieCatalog) catalog;
+ yield nessieCatalog.listNamespaces();
+ }
+ };
+ }
+
+ public static List<TableIdentifier> listTables(Catalog catalog, Namespace
namespace, CatalogConfig.IcebergCatalogSource source) {
+ return switch (source) {
+ case AWS_GLUE -> {
+ GlueCatalog glueCatalog = (GlueCatalog) catalog;
+ yield glueCatalog.listTables(namespace);
+ }
+ case REST, AWS_GLUE_REST, BIGLAKE_METASTORE, S3_TABLES,
NESSIE_REST -> {
+ RESTCatalog restCatalog = (RESTCatalog) catalog;
+ yield restCatalog.listTables(namespace);
+ }
+ case NESSIE -> {
+ NessieCatalog nessieCatalog = (NessieCatalog) catalog;
+ yield nessieCatalog.listTables(namespace);
+ }
+ };
+ }
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20949?usp=email
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: I99e48e51ac2081fc899d89bcbc22f3f00ee072e6
Gerrit-Change-Number: 20949
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <[email protected]>