Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#351] feat(catalog-lakehouse): make IcebergTableOps#updateTable more convenient #383

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ final class SetProperty implements TableChange {
private final String property;
private final String value;

private SetProperty(String property, String value) {
public SetProperty(String property, String value) {
this.property = property;
this.value = value;
}
Expand Down
9 changes: 9 additions & 0 deletions catalog-lakehouse/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugins {
dependencies {
implementation(project(":common"))
implementation(project(":core"))
implementation(project(":api"))
implementation(libs.jackson.databind)
implementation(libs.jackson.annotations)
implementation(libs.jackson.datatype.jdk8)
Expand All @@ -23,6 +24,14 @@ dependencies {
implementation(libs.bundles.jetty)
implementation(libs.bundles.jersey)
implementation(libs.bundles.iceberg)
implementation(libs.substrait.java.core) {
exclude("com.fasterxml.jackson.core")
exclude("com.fasterxml.jackson.datatype")
exclude("com.fasterxml.jackson.dataformat")
exclude("com.google.protobuf")
exclude("com.google.code.findbugs")
exclude("org.slf4j")
}

compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
*/
package com.datastrato.graviton.catalog.lakehouse.iceberg.ops;

import com.datastrato.graviton.catalog.lakehouse.iceberg.ops.IcebergTableOpsHelper.IcebergTableChange;
import com.datastrato.graviton.catalog.lakehouse.iceberg.utils.IcebergCatalogUtil;
import com.google.common.base.Preconditions;
import java.util.Optional;
import javax.ws.rs.NotSupportedException;
import org.apache.iceberg.Transaction;
import org.apache.iceberg.catalog.Catalog;
import org.apache.iceberg.catalog.Namespace;
import org.apache.iceberg.catalog.SupportsNamespaces;
Expand All @@ -31,7 +33,7 @@ public class IcebergTableOps {

private static final Logger LOG = LoggerFactory.getLogger(IcebergTableOps.class);

private Catalog catalog;
protected Catalog catalog;
private SupportsNamespaces asNamespaceCatalog;
private final String DEFAULT_ICEBERG_CATALOG_TYPE = "memory";

Expand All @@ -42,6 +44,10 @@ public IcebergTableOps() {
}
}

public IcebergTableOpsHelper createIcebergTableOpsHelper() {
return new IcebergTableOpsHelper(catalog);
}

private void validateNamespace(Optional<Namespace> namespace) {
namespace.ifPresent(
n ->
Expand Down Expand Up @@ -115,4 +121,10 @@ public LoadTableResponse updateTable(
TableIdentifier tableIdentifier, UpdateTableRequest updateTableRequest) {
return CatalogHandlers.updateTable(catalog, tableIdentifier, updateTableRequest);
}

public LoadTableResponse updateTable(IcebergTableChange icebergTableChange) {
Transaction transaction = icebergTableChange.getTransaction();
transaction.commitTransaction();
return loadTable(icebergTableChange.getTableIdentifier());
}
}
Loading