meethngala commented on code in PR #3643:
URL: https://github.com/apache/gobblin/pull/3643#discussion_r1113609147
##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergHiveCatalog.java:
##########
@@ -17,22 +17,54 @@
package org.apache.gobblin.data.management.copy.iceberg;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
+import org.apache.iceberg.catalog.Catalog;
import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.hive.HiveCatalog;
+import lombok.extern.slf4j.Slf4j;
+
/**
* Hive-Metastore-based {@link IcebergCatalog}.
*/
@Slf4j
-@AllArgsConstructor
public class IcebergHiveCatalog implements IcebergCatalog {
+
+ /**
+ * Ensures pairing between {@link IcebergCatalog} and its implementation
type i.e. {@link HiveCatalog} in this case.
+ * Unfortunately, {@link
org.apache.iceberg.BaseMetastoreCatalog}.newTableOps is protected.
+ * Hence, it necessitates this abstraction to define and access {@link
IcebergTable}
+ */
+ public static class HiveSpecifier implements CatalogSpecifier {
+
+ public static final String HIVE_CATALOG_NAME = "hive";
+ @Override
+ public Class<? extends Catalog> getCatalogClass() {
+ return HiveCatalog.class;
+ }
+
+ @Override
+ public Class<? extends IcebergCatalog> getIcebergCatalogClass() {
+ return IcebergHiveCatalog.class;
+ }
+
+ @Override
+ public String getCatalogName() {
+ return HIVE_CATALOG_NAME;
+ }
+ }
+
// NOTE: specifically necessitates `HiveCatalog`, as
`BaseMetastoreCatalog.newTableOps` is `protected`!
private final HiveCatalog hc;
+ public IcebergHiveCatalog(Catalog catalog) {
+ if (catalog instanceof HiveCatalog) {
+ hc = (HiveCatalog) catalog;
+ } else {
+ throw new IllegalArgumentException(String.format("Incorrect Catalog
Provided: Got %s instead of HiveCatalog " ,catalog.getClass().getName()));
Review Comment:
yeah... good catch 👍
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]