>From Hussain Towaileb <[email protected]>:

Hussain Towaileb has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20940?usp=email )


Change subject: MB-70659: Add datasource functions for iceberg entities
......................................................................

MB-70659: Add datasource functions for iceberg entities

Change-Id: I0df222064a414fe1206601e27f6ca6e0b554528d
---
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/40/20940/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/+/20940?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: I0df222064a414fe1206601e27f6ca6e0b554528d
Gerrit-Change-Number: 20940
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <[email protected]>

Reply via email to