danielcweeks commented on a change in pull request #1149:
URL: https://github.com/apache/iceberg/pull/1149#discussion_r448646423
##########
File path: spark3/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -228,13 +247,141 @@ public void invalidateTable(Identifier ident) {
}
}
+ @Override
+ public Identifier[] listTables(String[] namespace) {
+ return icebergCatalog.listTables(Namespace.of(namespace)).stream()
+ .map(ident -> Identifier.of(ident.namespace().levels(), ident.name()))
+ .toArray(Identifier[]::new);
+ }
+
+ @Override
+ public String[] defaultNamespace() {
+ if (defaultNamespace != null) {
+ return defaultNamespace;
+ }
+
+ return new String[0];
+ }
+
+ @Override
+ public String[][] listNamespaces() {
+ if (asNamespaceCatalog != null) {
+ return asNamespaceCatalog.listNamespaces().stream()
+ .map(Namespace::levels)
+ .toArray(String[][]::new);
+ }
+
+ return new String[0][];
+ }
+
+ @Override
+ public String[][] listNamespaces(String[] namespace) throws
NoSuchNamespaceException {
+ if (asNamespaceCatalog != null) {
+ try {
+ return
asNamespaceCatalog.listNamespaces(Namespace.of(namespace)).stream()
+ .map(Namespace::levels)
+ .toArray(String[][]::new);
+ } catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {
+ throw new NoSuchNamespaceException(namespace);
+ }
+ }
+
+ throw new NoSuchNamespaceException(namespace);
+ }
+
+ @Override
+ public Map<String, String> loadNamespaceMetadata(String[] namespace) throws
NoSuchNamespaceException {
+ if (asNamespaceCatalog != null) {
+ try {
+ return
asNamespaceCatalog.loadNamespaceMetadata(Namespace.of(namespace));
+ } catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {
+ throw new NoSuchNamespaceException(namespace);
+ }
+ }
+
+ throw new NoSuchNamespaceException(namespace);
+ }
+
+ @Override
+ public void createNamespace(String[] namespace, Map<String, String>
metadata) throws NamespaceAlreadyExistsException {
+ if (asNamespaceCatalog != null) {
+ try {
+ if (asNamespaceCatalog instanceof HadoopCatalog &&
DEFAULT_NS_KEYS.equals(metadata.keySet())) {
Review comment:
Maybe I'm missing something here, but doesn't this actually break for
HadoopCatalog without the default set of keys (it'll drop through and be
rejected in the `else` block)?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]