World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#67] refactor: change the terminology `Lakehouse` to `Metalake` in Graviton (#68)
Jerry Shao86d623a36d6b
diff --git a/api/src/main/java/com/datastrato/graviton/Lakehouse.java b/api/src/main/java/com/datastrato/graviton/Lakehouse.javadeleted file mode 100644index 064dd05cea..0000000000--- a/api/src/main/java/com/datastrato/graviton/Lakehouse.java+++ /dev/null@@ -1,19 +0,0 @@-package com.datastrato.graviton;--import java.util.Map;--/**- * The interface of a lakehouse. The lakehouse is the top level entity in the graviton system. It- * contains a set of catalogs.- */-public interface Lakehouse extends Auditable {-- /** The name of the lakehouse. */- String name();-- /** The comment of the lakehouse. */- String comment();-- /** The properties of the lakehouse. */- Map<String, String> properties();-}diff --git a/api/src/main/java/com/datastrato/graviton/LakehouseChange.java b/api/src/main/java/com/datastrato/graviton/LakehouseChange.javadeleted file mode 100644index dd21d4d35d..0000000000--- a/api/src/main/java/com/datastrato/graviton/LakehouseChange.java+++ /dev/null@@ -1,90 +0,0 @@-package com.datastrato.graviton;--import lombok.EqualsAndHashCode;-import lombok.Getter;--public interface LakehouseChange {-- /**- * Creates a new lakehouse change to rename the lakehouse.- *- * @param newName the new name of the lakehouse- * @return the lakehouse change- */- static LakehouseChange rename(String newName) {- return new RenameLakehouse(newName);- }-- /**- * Creates a new lakehouse change to update the lakehouse comment.- *- * @param newComment the new comment of the lakehouse- * @return the lakehouse change- */- static LakehouseChange updateComment(String newComment) {- return new UpdateLakehouseComment(newComment);- }-- /**- * Creates a new lakehouse change to set the property and value for the lakehouse.- *- * @param property the property name to set- * @param value the property value to set- * @return the lakehouse change- */- static LakehouseChange setProperty(String property, String value) {- return new SetProperty(property, value);- }-- /**- * Creates a new lakehouse change to remove the property from the lakehouse.- *- * @param property the property name to remove- * @return the lakehouse change- */- static LakehouseChange removeProperty(String property) {- return new RemoveProperty(property);- }-- @Getter- @EqualsAndHashCode- final class RenameLakehouse implements LakehouseChange {- private final String newName;-- private RenameLakehouse(String newName) {- this.newName = newName;- }- }-- @Getter- @EqualsAndHashCode- final class UpdateLakehouseComment implements LakehouseChange {- private final String newComment;-- private UpdateLakehouseComment(String newComment) {- this.newComment = newComment;- }- }-- @Getter- @EqualsAndHashCode- final class SetProperty implements LakehouseChange {- private final String property;- private final String value;-- private SetProperty(String property, String value) {- this.property = property;- this.value = value;- }- }-- @Getter- @EqualsAndHashCode- final class RemoveProperty implements LakehouseChange {- private final String property;-- private RemoveProperty(String property) {- this.property = property;- }- }-}diff --git a/api/src/main/java/com/datastrato/graviton/Metalake.java b/api/src/main/java/com/datastrato/graviton/Metalake.javanew file mode 100644index 0000000000..0261b1da9f--- /dev/null+++ b/api/src/main/java/com/datastrato/graviton/Metalake.java@@ -0,0 +1,19 @@+package com.datastrato.graviton;++import java.util.Map;++/**+ * The interface of a metalake. The metalake is the top level entity in the graviton system. It+ * contains a set of catalogs.+ */+public interface Metalake extends Auditable {++ /** The name of the metalake. */+ String name();++ /** The comment of the metalake. */+ String comment();++ /** The properties of the metalake. */+ Map<String, String> properties();+}diff --git a/api/src/main/java/com/datastrato/graviton/MetalakeChange.java b/api/src/main/java/com/datastrato/graviton/MetalakeChange.javanew file mode 100644index 0000000000..67e2b3bada--- /dev/null+++ b/api/src/main/java/com/datastrato/graviton/MetalakeChange.java@@ -0,0 +1,90 @@+package com.datastrato.graviton;++import lombok.EqualsAndHashCode;+import lombok.Getter;++public interface MetalakeChange {++ /**+ * Creates a new metalake change to rename the metalake.+ *+ * @param newName the new name of the metalake+ * @return the metalake change+ */+ static MetalakeChange rename(String newName) {+ return new RenameMetalake(newName);+ }++ /**+ * Creates a new metalake change to update the metalake comment.+ *+ * @param newComment the new comment of the metalake+ * @return the metalake change+ */+ static MetalakeChange updateComment(String newComment) {+ return new UpdateMetalakeComment(newComment);+ }++ /**+ * Creates a new metalake change to set the property and value for the metalake.+ *+ * @param property the property name to set+ * @param value the property value to set+ * @return the metalake change+ */+ static MetalakeChange setProperty(String property, String value) {+ return new SetProperty(property, value);+ }++ /**+ * Creates a new metalake change to remove the property from the metalake.+ *+ * @param property the property name to remove+ * @return the metalake change+ */+ static MetalakeChange removeProperty(String property) {+ return new RemoveProperty(property);+ }++ @Getter+ @EqualsAndHashCode+ final class RenameMetalake implements MetalakeChange {+ private final String newName;++ private RenameMetalake(String newName) {+ this.newName = newName;+ }+ }++ @Getter+ @EqualsAndHashCode+ final class UpdateMetalakeComment implements MetalakeChange {+ private final String newComment;++ private UpdateMetalakeComment(String newComment) {+ this.newComment = newComment;+ }+ }++ @Getter+ @EqualsAndHashCode+ final class SetProperty implements MetalakeChange {+ private final String property;+ private final String value;++ private SetProperty(String property, String value) {+ this.property = property;+ this.value = value;+ }+ }++ @Getter+ @EqualsAndHashCode+ final class RemoveProperty implements MetalakeChange {+ private final String property;++ private RemoveProperty(String property) {+ this.property = property;+ }+ }+}diff --git a/api/src/main/java/com/datastrato/graviton/SupportCatalogs.java b/api/src/main/java/com/datastrato/graviton/SupportCatalogs.javaindex f6c8fc2abb..783d08eed8 100644--- a/api/src/main/java/com/datastrato/graviton/SupportCatalogs.java+++ b/api/src/main/java/com/datastrato/graviton/SupportCatalogs.java@@ -2,19 +2,19 @@ package com.datastrato.graviton;import com.datastrato.graviton.exceptions.CatalogAlreadyExistsException;import com.datastrato.graviton.exceptions.NoSuchCatalogException;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;import java.util.Map;public interface SupportCatalogs {/**- * List all catalogs in the lakehouse under the namespace {@link Namespace}.+ * List all catalogs in the metalake under the namespace {@link Namespace}.** @param namespace The namespace to list the catalogs under it.* @return The list of catalogs.- * @throws NoSuchLakehouseException If the lakehouse with namespace does not exist.+ * @throws NoSuchmetalakeException If the metalake with namespace does not exist.*/- Catalog[] listCatalogs(Namespace namespace) throws NoSuchLakehouseException;+ Catalog[] listCatalogs(Namespace namespace) throws NoSuchMetalakeException;/*** Load a catalog by its identifier.@@ -48,12 +48,12 @@ public interface SupportCatalogs {* @param comment the comment of the catalog.* @param properties the properties of the catalog.* @return The created catalog.- * @throws NoSuchLakehouseException If the lakehouse does not exist.+ * @throws NoSuchmetalakeException If the metalake does not exist.* @throws CatalogAlreadyExistsException If the catalog already exists.*/Catalog createCatalog(NameIdentifier ident, Catalog.Type type, String comment, Map<String, String> properties)- throws NoSuchLakehouseException, CatalogAlreadyExistsException;+ throws NoSuchMetalakeException, CatalogAlreadyExistsException;/*** Alter a catalog with specified identifier.diff --git a/api/src/main/java/com/datastrato/graviton/SupportLakehouses.java b/api/src/main/java/com/datastrato/graviton/SupportLakehouses.javadeleted file mode 100644index 3146dd5005..0000000000--- a/api/src/main/java/com/datastrato/graviton/SupportLakehouses.java+++ /dev/null@@ -1,67 +0,0 @@-package com.datastrato.graviton;--import com.datastrato.graviton.exceptions.LakehouseAlreadyExistsException;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;-import java.util.Map;--public interface SupportLakehouses {-- /** List all lakehouses. */- Lakehouse[] listLakehouses();-- /**- * Load a lakehouse by its identifier.- *- * @param ident the identifier of the lakehouse.- * @return The lakehouse.- * @throws NoSuchLakehouseException If the lakehouse does not exist.- */- Lakehouse loadLakehouse(NameIdentifier ident) throws NoSuchLakehouseException;-- /**- * Check if a lakehouse exists.- *- * @param ident The identifier of the lakehouse.- * @return True if the lakehouse exists, false otherwise.- */- default boolean lakehouseExists(NameIdentifier ident) {- try {- loadLakehouse(ident);- return true;- } catch (NoSuchLakehouseException e) {- return false;- }- }-- /**- * Create a lakehouse with specified identifier.- *- * @param ident The identifier of the lakehouse.- * @param comment The comment of the lakehouse.- * @param properties The properties of the lakehouse.- * @return The created lakehouse.- * @throws LakehouseAlreadyExistsException If the lakehouse already exists.- */- Lakehouse createLakehouse(NameIdentifier ident, String comment, Map<String, String> properties)- throws LakehouseAlreadyExistsException;-- /**- * Alter a lakehouse with specified identifier.- *- * @param ident The identifier of the lakehouse.- * @param changes The changes to apply.- * @return The altered lakehouse.- * @throws NoSuchLakehouseException If the lakehouse does not exist.- * @throws IllegalArgumentException If the changes cannot be applied to the lakehouse.- */- Lakehouse alterLakehouse(NameIdentifier ident, LakehouseChange... changes)- throws NoSuchLakehouseException, IllegalArgumentException;-- /**- * Drop a lakehouse with specified identifier.- *- * @param ident The identifier of the lakehouse.- * @return True if the lakehouse was dropped, false otherwise.- */- boolean dropLakehouse(NameIdentifier ident);-}diff --git a/api/src/main/java/com/datastrato/graviton/SupportMetalakes.java b/api/src/main/java/com/datastrato/graviton/SupportMetalakes.javanew file mode 100644index 0000000000..15ce18f39d--- /dev/null+++ b/api/src/main/java/com/datastrato/graviton/SupportMetalakes.java@@ -0,0 +1,67 @@+package com.datastrato.graviton;++import com.datastrato.graviton.exceptions.MetalakeAlreadyExistsException;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;+import java.util.Map;++public interface SupportMetalakes {++ /** List all metalakes. */+ Metalake[] listMetalakes();++ /**+ * Load a metalake by its identifier.+ *+ * @param ident the identifier of the metalake.+ * @return The metalake.+ * @throws NoSuchMetalakeException If the metalake does not exist.+ */+ Metalake loadMetalake(NameIdentifier ident) throws NoSuchMetalakeException;++ /**+ * Check if a metalake exists.+ *+ * @param ident The identifier of the metalake.+ * @return True if the metalake exists, false otherwise.+ */+ default boolean metalakeExists(NameIdentifier ident) {+ try {+ loadMetalake(ident);+ return true;+ } catch (NoSuchMetalakeException e) {+ return false;+ }+ }++ /**+ * Create a metalake with specified identifier.+ *+ * @param ident The identifier of the metalake.+ * @param comment The comment of the metalake.+ * @param properties The properties of the metalake.+ * @return The created metalake.+ * @throws MetalakeAlreadyExistsException If the metalake already exists.+ */+ Metalake createMetalake(NameIdentifier ident, String comment, Map<String, String> properties)+ throws MetalakeAlreadyExistsException;++ /**+ * Alter a metalake with specified identifier.+ *+ * @param ident The identifier of the metalake.+ * @param changes The changes to apply.+ * @return The altered metalake.+ * @throws NoSuchmetalakeException If the metalake does not exist.+ * @throws IllegalArgumentException If the changes cannot be applied to the metalake.+ */+ Metalake alterMetalake(NameIdentifier ident, MetalakeChange... changes)+ throws NoSuchMetalakeException, IllegalArgumentException;++ /**+ * Drop a metalake with specified identifier.+ *+ * @param ident The identifier of the metalake.+ * @return True if the metalake was dropped, false otherwise.+ */+ boolean dropMetalake(NameIdentifier ident);+}diff --git a/api/src/main/java/com/datastrato/graviton/exceptions/LakehouseAlreadyExistsException.java b/api/src/main/java/com/datastrato/graviton/exceptions/LakehouseAlreadyExistsException.javadeleted file mode 100644index a9791d112a..0000000000--- a/api/src/main/java/com/datastrato/graviton/exceptions/LakehouseAlreadyExistsException.java+++ /dev/null@@ -1,12 +0,0 @@-package com.datastrato.graviton.exceptions;--public class LakehouseAlreadyExistsException extends AlreadyExistsException {-- public LakehouseAlreadyExistsException(String message) {- super(message);- }-- public LakehouseAlreadyExistsException(String message, Throwable cause) {- super(message, cause);- }-}diff --git a/api/src/main/java/com/datastrato/graviton/exceptions/MetalakeAlreadyExistsException.java b/api/src/main/java/com/datastrato/graviton/exceptions/MetalakeAlreadyExistsException.javanew file mode 100644index 0000000000..bdddac6a8e--- /dev/null+++ b/api/src/main/java/com/datastrato/graviton/exceptions/MetalakeAlreadyExistsException.java@@ -0,0 +1,12 @@+package com.datastrato.graviton.exceptions;++public class MetalakeAlreadyExistsException extends AlreadyExistsException {++ public MetalakeAlreadyExistsException(String message) {+ super(message);+ }++ public MetalakeAlreadyExistsException(String message, Throwable cause) {+ super(message, cause);+ }+}diff --git a/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchLakehouseException.java b/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchLakehouseException.javadeleted file mode 100644index 79b3e3fb0d..0000000000--- a/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchLakehouseException.java+++ /dev/null@@ -1,12 +0,0 @@-package com.datastrato.graviton.exceptions;--public class NoSuchLakehouseException extends NotFoundException {-- public NoSuchLakehouseException(String message) {- super(message);- }-- public NoSuchLakehouseException(String message, Throwable cause) {- super(message, cause);- }-}diff --git a/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchMetalakeException.java b/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchMetalakeException.javanew file mode 100644index 0000000000..86a6a476b8--- /dev/null+++ b/api/src/main/java/com/datastrato/graviton/exceptions/NoSuchMetalakeException.java@@ -0,0 +1,12 @@+package com.datastrato.graviton.exceptions;++public class NoSuchMetalakeException extends NotFoundException {++ public NoSuchMetalakeException(String message) {+ super(message);+ }++ public NoSuchMetalakeException(String message, Throwable cause) {+ super(message, cause);+ }+}diff --git a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalog.java b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalog.javaindex 18bf6e91c2..5ca33ca764 100644--- a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalog.java+++ b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalog.java@@ -36,7 +36,7 @@ public class HiveCatalog extends BaseCatalog {@Overrideprotected HiveCatalog internalBuild() {hiveCatalog.id = id;- hiveCatalog.lakehouseId = lakehouseId;+ hiveCatalog.metalakeId = metalakeId;hiveCatalog.name = name;hiveCatalog.namespace = namespace;hiveCatalog.type = type;diff --git a/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/HiveCatalogTest.java b/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/HiveCatalogTest.javaindex bc7fbb1081..01b47025a4 100644--- a/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/HiveCatalogTest.java+++ b/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/HiveCatalogTest.java@@ -19,9 +19,9 @@ public class HiveCatalogTest extends MiniHiveMetastoreService {new HiveCatalog.Builder().withId(1L).withName("catalog")- .withNamespace(Namespace.of("lakehouse"))+ .withNamespace(Namespace.of("metalake")).withType(HiveCatalog.Type.RELATIONAL)- .withLakehouseId(1L)+ .withMetalakeId(1L).withAuditInfo(auditInfo).withHiveConf(metastore.hiveConf()).build();diff --git a/common/src/main/java/com/datastrato/graviton/dto/LakehouseDTO.java b/common/src/main/java/com/datastrato/graviton/dto/MetalakeDTO.javasimilarity index 84%rename from common/src/main/java/com/datastrato/graviton/dto/LakehouseDTO.javarename to common/src/main/java/com/datastrato/graviton/dto/MetalakeDTO.javaindex 1f487c3c42..6e1bcccdd5 100644--- a/common/src/main/java/com/datastrato/graviton/dto/LakehouseDTO.java+++ b/common/src/main/java/com/datastrato/graviton/dto/MetalakeDTO.java@@ -1,7 +1,7 @@package com.datastrato.graviton.dto;import com.datastrato.graviton.Audit;-import com.datastrato.graviton.Lakehouse;+import com.datastrato.graviton.Metalake;import com.fasterxml.jackson.annotation.JsonProperty;import com.google.common.base.Preconditions;import java.util.Map;@@ -11,7 +11,7 @@ import lombok.ToString;@EqualsAndHashCode@ToString-public class LakehouseDTO implements Lakehouse {+public class MetalakeDTO implements Metalake {@JsonProperty("name")private String name;@@ -27,10 +27,9 @@ public class LakehouseDTO implements Lakehouse {@JsonProperty("audit")private AuditDTO audit;- private LakehouseDTO() {}+ private MetalakeDTO() {}- private LakehouseDTO(- String name, String comment, Map<String, String> properties, AuditDTO audit) {+ private MetalakeDTO(String name, String comment, Map<String, String> properties, AuditDTO audit) {this.name = name;this.comment = comment;this.properties = properties;@@ -90,10 +89,10 @@ public class LakehouseDTO implements Lakehouse {return (S) this;}- public LakehouseDTO build() {+ public MetalakeDTO build() {Preconditions.checkArgument(name != null && !name.isEmpty(), "name cannot be null or empty");Preconditions.checkArgument(audit != null, "audit cannot be null");- return new LakehouseDTO(name, comment, properties, audit);+ return new MetalakeDTO(name, comment, properties, audit);}}}diff --git a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseCreateRequest.java b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeCreateRequest.javasimilarity index 84%rename from common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseCreateRequest.javarename to common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeCreateRequest.javaindex 783c0cd96d..eeab22c5c2 100644--- a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseCreateRequest.java+++ b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeCreateRequest.java@@ -11,7 +11,7 @@ import lombok.Getter;@Getter@EqualsAndHashCode-public class LakehouseCreateRequest implements RESTRequest {+public class MetalakeCreateRequest implements RESTRequest {@JsonProperty("name")private String name;@@ -25,11 +25,11 @@ public class LakehouseCreateRequest implements RESTRequest {private Map<String, String> properties;// Only for Jackson deserialization- public LakehouseCreateRequest() {+ public MetalakeCreateRequest() {this(null, null, null);}- public LakehouseCreateRequest(String name, String comment, Map<String, String> properties) {+ public MetalakeCreateRequest(String name, String comment, Map<String, String> properties) {super();this.name = Optional.ofNullable(name).map(String::trim).orElse(null);diff --git a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdateRequest.java b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdateRequest.javasimilarity index 61%rename from common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdateRequest.javarename to common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdateRequest.javaindex d5821e83f1..ee78915ee4 100644--- a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdateRequest.java+++ b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdateRequest.java@@ -1,6 +1,6 @@package com.datastrato.graviton.dto.requests;-import com.datastrato.graviton.LakehouseChange;+import com.datastrato.graviton.MetalakeChange;import com.datastrato.graviton.dto.RESTRequest;import com.fasterxml.jackson.annotation.*;import com.google.common.base.Preconditions;@@ -10,33 +10,33 @@ import lombok.Getter;@JsonIgnoreProperties(ignoreUnknown = true)@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY)@JsonSubTypes({- @JsonSubTypes.Type(value = LakehouseUpdateRequest.RenameLakehouseRequest.class, name = "rename"),+ @JsonSubTypes.Type(value = MetalakeUpdateRequest.RenameMetalakeRequest.class, name = "rename"),@JsonSubTypes.Type(- value = LakehouseUpdateRequest.UpdateLakehouseCommentRequest.class,+ value = MetalakeUpdateRequest.UpdateMetalakeCommentRequest.class,name = "updateComment"),@JsonSubTypes.Type(- value = LakehouseUpdateRequest.SetLakehousePropertyRequest.class,+ value = MetalakeUpdateRequest.SetMetalakePropertyRequest.class,name = "setProperty"),@JsonSubTypes.Type(- value = LakehouseUpdateRequest.RemoveLakehousePropertyRequest.class,+ value = MetalakeUpdateRequest.RemoveMetalakePropertyRequest.class,name = "removeProperty")})-public interface LakehouseUpdateRequest extends RESTRequest {+public interface MetalakeUpdateRequest extends RESTRequest {- LakehouseChange lakehouseChange();+ MetalakeChange metalakeChange();@EqualsAndHashCode- class RenameLakehouseRequest implements LakehouseUpdateRequest {+ class RenameMetalakeRequest implements MetalakeUpdateRequest {@Getter@JsonProperty("newName")private final String newName;- public RenameLakehouseRequest(String newName) {+ public RenameMetalakeRequest(String newName) {this.newName = newName;}- public RenameLakehouseRequest() {+ public RenameMetalakeRequest() {this(null);}@@ -48,23 +48,23 @@ public interface LakehouseUpdateRequest extends RESTRequest {}@Override- public LakehouseChange lakehouseChange() {- return LakehouseChange.rename(newName);+ public MetalakeChange metalakeChange() {+ return MetalakeChange.rename(newName);}}@EqualsAndHashCode- class UpdateLakehouseCommentRequest implements LakehouseUpdateRequest {+ class UpdateMetalakeCommentRequest implements MetalakeUpdateRequest {@Getter@JsonProperty("newComment")private final String newComment;- public UpdateLakehouseCommentRequest(String newComment) {+ public UpdateMetalakeCommentRequest(String newComment) {this.newComment = newComment;}- public UpdateLakehouseCommentRequest() {+ public UpdateMetalakeCommentRequest() {this(null);}@@ -76,13 +76,13 @@ public interface LakehouseUpdateRequest extends RESTRequest {}@Override- public LakehouseChange lakehouseChange() {- return LakehouseChange.updateComment(newComment);+ public MetalakeChange metalakeChange() {+ return MetalakeChange.updateComment(newComment);}}@EqualsAndHashCode- class SetLakehousePropertyRequest implements LakehouseUpdateRequest {+ class SetMetalakePropertyRequest implements MetalakeUpdateRequest {@Getter@JsonProperty("property")@@ -91,12 +91,12 @@ public interface LakehouseUpdateRequest extends RESTRequest {@JsonProperty("value")private final String value;- public SetLakehousePropertyRequest(String property, String value) {+ public SetMetalakePropertyRequest(String property, String value) {this.property = property;this.value = value;}- public SetLakehousePropertyRequest() {+ public SetMetalakePropertyRequest() {this(null, null);}@@ -110,23 +110,23 @@ public interface LakehouseUpdateRequest extends RESTRequest {}@Override- public LakehouseChange lakehouseChange() {- return LakehouseChange.setProperty(property, value);+ public MetalakeChange metalakeChange() {+ return MetalakeChange.setProperty(property, value);}}@EqualsAndHashCode- class RemoveLakehousePropertyRequest implements LakehouseUpdateRequest {+ class RemoveMetalakePropertyRequest implements MetalakeUpdateRequest {@Getter@JsonProperty("property")private final String property;- public RemoveLakehousePropertyRequest(String property) {+ public RemoveMetalakePropertyRequest(String property) {this.property = property;}- public RemoveLakehousePropertyRequest() {+ public RemoveMetalakePropertyRequest() {this(null);}@@ -138,8 +138,8 @@ public interface LakehouseUpdateRequest extends RESTRequest {}@Override- public LakehouseChange lakehouseChange() {- return LakehouseChange.removeProperty(property);+ public MetalakeChange metalakeChange() {+ return MetalakeChange.removeProperty(property);}}}diff --git a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdatesRequest.java b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdatesRequest.javasimilarity index 67%rename from common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdatesRequest.javarename to common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdatesRequest.javaindex 17223a4faa..79a57500c3 100644--- a/common/src/main/java/com/datastrato/graviton/dto/requests/LakehouseUpdatesRequest.java+++ b/common/src/main/java/com/datastrato/graviton/dto/requests/MetalakeUpdatesRequest.java@@ -8,16 +8,16 @@ import lombok.Getter;@Getter@EqualsAndHashCode-public class LakehouseUpdatesRequest implements RESTRequest {+public class MetalakeUpdatesRequest implements RESTRequest {@JsonProperty("requests")- private final List<LakehouseUpdateRequest> requests;+ private final List<MetalakeUpdateRequest> requests;- public LakehouseUpdatesRequest(List<LakehouseUpdateRequest> requests) {+ public MetalakeUpdatesRequest(List<MetalakeUpdateRequest> requests) {this.requests = requests;}- public LakehouseUpdatesRequest() {+ public MetalakeUpdatesRequest() {this(null);}diff --git a/common/src/main/java/com/datastrato/graviton/dto/responses/LakehouseResponse.java b/common/src/main/java/com/datastrato/graviton/dto/responses/MetalakeResponse.javasimilarity index 52%rename from common/src/main/java/com/datastrato/graviton/dto/responses/LakehouseResponse.javarename to common/src/main/java/com/datastrato/graviton/dto/responses/MetalakeResponse.javaindex b6a7484e58..e86eda5f33 100644--- a/common/src/main/java/com/datastrato/graviton/dto/responses/LakehouseResponse.java+++ b/common/src/main/java/com/datastrato/graviton/dto/responses/MetalakeResponse.java@@ -1,6 +1,6 @@package com.datastrato.graviton.dto.responses;-import com.datastrato.graviton.dto.LakehouseDTO;+import com.datastrato.graviton.dto.MetalakeDTO;import com.fasterxml.jackson.annotation.JsonProperty;import lombok.EqualsAndHashCode;import lombok.Getter;@@ -9,19 +9,19 @@ import lombok.ToString;@Getter@ToString@EqualsAndHashCode(callSuper = true)-public class LakehouseResponse extends BaseResponse {+public class MetalakeResponse extends BaseResponse {- @JsonProperty("lakehouse")- private final LakehouseDTO lakehouse;+ @JsonProperty("metalake")+ private final MetalakeDTO metalake;- public LakehouseResponse(LakehouseDTO lakehouse) {+ public MetalakeResponse(MetalakeDTO metalake) {super(0, null, null);- this.lakehouse = lakehouse;+ this.metalake = metalake;}// This is the constructor that is used by Jackson deserializer- public LakehouseResponse() {+ public MetalakeResponse() {super();- this.lakehouse = null;+ this.metalake = null;}}diff --git a/common/src/test/java/com/datastrato/graviton/json/TestDTOJsonSerDe.java b/common/src/test/java/com/datastrato/graviton/json/TestDTOJsonSerDe.javaindex c4d245c77e..fe325f7cce 100644--- a/common/src/test/java/com/datastrato/graviton/json/TestDTOJsonSerDe.java+++ b/common/src/test/java/com/datastrato/graviton/json/TestDTOJsonSerDe.java@@ -3,7 +3,7 @@ package com.datastrato.graviton.json;import com.datastrato.graviton.Catalog;import com.datastrato.graviton.dto.AuditDTO;import com.datastrato.graviton.dto.CatalogDTO;-import com.datastrato.graviton.dto.LakehouseDTO;+import com.datastrato.graviton.dto.MetalakeDTO;import com.datastrato.graviton.dto.rel.ColumnDTO;import com.datastrato.graviton.dto.rel.TableDTO;import com.google.common.collect.ImmutableMap;@@ -18,8 +18,7 @@ public class TestDTOJsonSerDe {private final String auditJson ="{\"creator\":%s,\"createTime\":%s,\"lastModifier\":%s,\"lastModifiedTime\":%s}";- private final String lakehouseJson =- "{\"name\":%s,\"comment\":%s,\"properties\":%s,\"audit\":%s}";+ private final String metalakeJson = "{\"name\":%s,\"comment\":%s,\"properties\":%s,\"audit\":%s}";private final String columnJson = "{\"name\":%s,\"type\":%s,\"comment\":%s}";@@ -69,9 +68,9 @@ public class TestDTOJsonSerDe {}@Test- public void testLakehouseDTOSerDe() throws Exception {+ public void testMetalakeDTOSerDe() throws Exception {Long id = 1L;- String name = "lakehouse";+ String name = "metalake";String comment = "comment";Map<String, String> properties = ImmutableMap.of("k1", "v1", "k2", "v2");String creator = "creator";@@ -79,40 +78,40 @@ public class TestDTOJsonSerDe {AuditDTO audit = AuditDTO.builder().withCreator(creator).withCreateTime(now).build();// Test with required fields- LakehouseDTO lakehouse =- LakehouseDTO.builder()+ MetalakeDTO metalake =+ MetalakeDTO.builder().withName(name).withComment(comment).withProperties(properties).withAudit(audit).build();- String serJson = JsonUtils.objectMapper().writeValueAsString(lakehouse);+ String serJson = JsonUtils.objectMapper().writeValueAsString(metalake);String expectedJson =String.format(- lakehouseJson,+ metalakeJson,withQuotes(name),withQuotes(comment),JsonUtils.objectMapper().writeValueAsString(properties),String.format(auditJson, withQuotes(creator), withQuotes(now.toString()), null, null));Assertions.assertEquals(expectedJson, serJson);- LakehouseDTO deserLakehouse = JsonUtils.objectMapper().readValue(serJson, LakehouseDTO.class);- Assertions.assertEquals(lakehouse, deserLakehouse);+ MetalakeDTO desermetalake = JsonUtils.objectMapper().readValue(serJson, MetalakeDTO.class);+ Assertions.assertEquals(metalake, desermetalake);// Test with optional fields- LakehouseDTO lakehouse1 = LakehouseDTO.builder().withName(name).withAudit(audit).build();+ MetalakeDTO metalake1 = MetalakeDTO.builder().withName(name).withAudit(audit).build();- String serJson1 = JsonUtils.objectMapper().writeValueAsString(lakehouse1);+ String serJson1 = JsonUtils.objectMapper().writeValueAsString(metalake1);String expectedJson1 =String.format(- lakehouseJson,+ metalakeJson,withQuotes(name),null,null,String.format(auditJson, withQuotes(creator), withQuotes(now.toString()), null, null));Assertions.assertEquals(expectedJson1, serJson1);- LakehouseDTO deserLakehouse1 = JsonUtils.objectMapper().readValue(serJson1, LakehouseDTO.class);- Assertions.assertEquals(lakehouse1, deserLakehouse1);+ MetalakeDTO desermetalake1 = JsonUtils.objectMapper().readValue(serJson1, MetalakeDTO.class);+ Assertions.assertEquals(metalake1, desermetalake1);}@Testdiff --git a/common/src/test/java/com/datastrato/graviton/json/TestRequestJsonSerDe.java b/common/src/test/java/com/datastrato/graviton/json/TestRequestJsonSerDe.javaindex 5b2bd98e37..70109c6f05 100644--- a/common/src/test/java/com/datastrato/graviton/json/TestRequestJsonSerDe.java+++ b/common/src/test/java/com/datastrato/graviton/json/TestRequestJsonSerDe.java@@ -11,68 +11,67 @@ import org.junit.jupiter.api.Test;public class TestRequestJsonSerDe {@Test- public void testLakehouseCreateRequestSerDe() throws JsonProcessingException {- LakehouseCreateRequest request =- new LakehouseCreateRequest("lakehouse", "comment", ImmutableMap.of("key", "value"));+ public void testMetalakeCreateRequestSerDe() throws JsonProcessingException {+ MetalakeCreateRequest request =+ new MetalakeCreateRequest("metalake", "comment", ImmutableMap.of("key", "value"));String serJson = JsonUtils.objectMapper().writeValueAsString(request);- LakehouseCreateRequest deserRequest =- JsonUtils.objectMapper().readValue(serJson, LakehouseCreateRequest.class);+ MetalakeCreateRequest deserRequest =+ JsonUtils.objectMapper().readValue(serJson, MetalakeCreateRequest.class);Assertions.assertEquals(request, deserRequest);// Test with optional fields- LakehouseCreateRequest request1 = new LakehouseCreateRequest("lakehouse", null, null);+ MetalakeCreateRequest request1 = new MetalakeCreateRequest("Metalake", null, null);String serJson1 = JsonUtils.objectMapper().writeValueAsString(request1);- LakehouseCreateRequest deserRequest1 =- JsonUtils.objectMapper().readValue(serJson1, LakehouseCreateRequest.class);+ MetalakeCreateRequest deserRequest1 =+ JsonUtils.objectMapper().readValue(serJson1, MetalakeCreateRequest.class);Assertions.assertEquals(request1, deserRequest1);- LakehouseCreateRequest request2 = new LakehouseCreateRequest("lakehouse", "", null);+ MetalakeCreateRequest request2 = new MetalakeCreateRequest("Metalake", "", null);String serJson2 = JsonUtils.objectMapper().writeValueAsString(request2);- LakehouseCreateRequest deserRequest2 =- JsonUtils.objectMapper().readValue(serJson2, LakehouseCreateRequest.class);+ MetalakeCreateRequest deserRequest2 =+ JsonUtils.objectMapper().readValue(serJson2, MetalakeCreateRequest.class);Assertions.assertEquals(request2, deserRequest2);- LakehouseCreateRequest request3 =- new LakehouseCreateRequest("lakehouse", "", ImmutableMap.of());+ MetalakeCreateRequest request3 = new MetalakeCreateRequest("Metalake", "", ImmutableMap.of());String serJson3 = JsonUtils.objectMapper().writeValueAsString(request3);- LakehouseCreateRequest deserRequest3 =- JsonUtils.objectMapper().readValue(serJson3, LakehouseCreateRequest.class);+ MetalakeCreateRequest deserRequest3 =+ JsonUtils.objectMapper().readValue(serJson3, MetalakeCreateRequest.class);Assertions.assertEquals(request3, deserRequest3);}@Test- public void testLakehouseUpdateRequestSerDe() throws JsonProcessingException {- LakehouseUpdateRequest req = new LakehouseUpdateRequest.RenameLakehouseRequest("newLakehouse");+ public void testmetalakeUpdateRequestSerDe() throws JsonProcessingException {+ MetalakeUpdateRequest req = new MetalakeUpdateRequest.RenameMetalakeRequest("newMetalake");String serJson = JsonUtils.objectMapper().writeValueAsString(req);- LakehouseUpdateRequest deserReq =- JsonUtils.objectMapper().readValue(serJson, LakehouseUpdateRequest.class);+ MetalakeUpdateRequest deserReq =+ JsonUtils.objectMapper().readValue(serJson, MetalakeUpdateRequest.class);Assertions.assertEquals(req, deserReq);- LakehouseUpdateRequest req1 =- new LakehouseUpdateRequest.UpdateLakehouseCommentRequest("newComment");+ MetalakeUpdateRequest req1 =+ new MetalakeUpdateRequest.UpdateMetalakeCommentRequest("newComment");String serJson1 = JsonUtils.objectMapper().writeValueAsString(req1);- LakehouseUpdateRequest deserReq1 =- JsonUtils.objectMapper().readValue(serJson1, LakehouseUpdateRequest.class);+ MetalakeUpdateRequest deserReq1 =+ JsonUtils.objectMapper().readValue(serJson1, MetalakeUpdateRequest.class);Assertions.assertEquals(req1, deserReq1);- LakehouseUpdateRequest req2 =- new LakehouseUpdateRequest.SetLakehousePropertyRequest("key", "value");+ MetalakeUpdateRequest req2 =+ new MetalakeUpdateRequest.SetMetalakePropertyRequest("key", "value");String serJson2 = JsonUtils.objectMapper().writeValueAsString(req2);- LakehouseUpdateRequest deserReq2 =- JsonUtils.objectMapper().readValue(serJson2, LakehouseUpdateRequest.class);+ MetalakeUpdateRequest deserReq2 =+ JsonUtils.objectMapper().readValue(serJson2, MetalakeUpdateRequest.class);Assertions.assertEquals(req2, deserReq2);- LakehouseUpdateRequest req3 = new LakehouseUpdateRequest.RemoveLakehousePropertyRequest("key");+ MetalakeUpdateRequest req3 = new MetalakeUpdateRequest.RemoveMetalakePropertyRequest("key");String serJson3 = JsonUtils.objectMapper().writeValueAsString(req3);- LakehouseUpdateRequest deserReq3 =- JsonUtils.objectMapper().readValue(serJson3, LakehouseUpdateRequest.class);+ MetalakeUpdateRequest deserReq3 =+ JsonUtils.objectMapper().readValue(serJson3, MetalakeUpdateRequest.class);Assertions.assertEquals(req3, deserReq3);- LakehouseUpdatesRequest req4 =- new LakehouseUpdatesRequest(ImmutableList.of(req, req1, req2, req3));+ MetalakeUpdatesRequest req4 =+ new MetalakeUpdatesRequest(ImmutableList.of(req, req1, req2, req3));String serJson4 = JsonUtils.objectMapper().writeValueAsString(req4);- LakehouseUpdatesRequest deserReq4 =- JsonUtils.objectMapper().readValue(serJson4, LakehouseUpdatesRequest.class);+ MetalakeUpdatesRequest deserReq4 =+ JsonUtils.objectMapper().readValue(serJson4, MetalakeUpdatesRequest.class);Assertions.assertEquals(req4, deserReq4);}diff --git a/common/src/test/java/com/datastrato/graviton/json/TestResponseJsonSerDe.java b/common/src/test/java/com/datastrato/graviton/json/TestResponseJsonSerDe.javaindex 284ab1baf7..39c8ab7fe8 100644--- a/common/src/test/java/com/datastrato/graviton/json/TestResponseJsonSerDe.java+++ b/common/src/test/java/com/datastrato/graviton/json/TestResponseJsonSerDe.java@@ -1,10 +1,10 @@package com.datastrato.graviton.json;import com.datastrato.graviton.dto.AuditDTO;-import com.datastrato.graviton.dto.LakehouseDTO;+import com.datastrato.graviton.dto.MetalakeDTO;import com.datastrato.graviton.dto.responses.BaseResponse;import com.datastrato.graviton.dto.responses.ErrorType;-import com.datastrato.graviton.dto.responses.LakehouseResponse;+import com.datastrato.graviton.dto.responses.MetalakeResponse;import com.fasterxml.jackson.core.JsonProcessingException;import com.google.common.collect.ImmutableMap;import java.time.Instant;@@ -27,20 +27,20 @@ public class TestResponseJsonSerDe {}@Test- public void testLakehouseResponseSerDe() throws JsonProcessingException {- LakehouseDTO lakehouse =- LakehouseDTO.builder()- .withName("lakehouse")+ public void testMetalakeResponseSerDe() throws JsonProcessingException {+ MetalakeDTO metalake =+ MetalakeDTO.builder()+ .withName("metalake").withComment("comment").withProperties(ImmutableMap.of("key", "value")).withAudit(AuditDTO.builder().withCreator("creator").withCreateTime(Instant.now()).build()).build();- LakehouseResponse response = new LakehouseResponse(lakehouse);+ MetalakeResponse response = new MetalakeResponse(metalake);String serJson = JsonUtils.objectMapper().writeValueAsString(response);- LakehouseResponse deserResponse =- JsonUtils.objectMapper().readValue(serJson, LakehouseResponse.class);+ MetalakeResponse deserResponse =+ JsonUtils.objectMapper().readValue(serJson, MetalakeResponse.class);Assertions.assertEquals(response, deserResponse);}}diff --git a/core/src/main/java/com/datastrato/graviton/meta/BaseCatalog.java b/core/src/main/java/com/datastrato/graviton/meta/BaseCatalog.javaindex 5e9733e319..a94c855558 100644--- a/core/src/main/java/com/datastrato/graviton/meta/BaseCatalog.java+++ b/core/src/main/java/com/datastrato/graviton/meta/BaseCatalog.java@@ -21,8 +21,8 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIdenpublic static final Field ID =Field.required("id", Long.class, "The unique identifier of the catalog");- public static final Field LAKEHOUSE_ID =- Field.required("lakehouse_id", Long.class, "The unique identifier of the lakehouse");+ public static final Field METALAKE_ID =+ Field.required("metalake_id", Long.class, "The unique identifier of the metalake");public static final Field NAME = Field.required("name", String.class, "The name of the catalog");public static final Field TYPE = Field.required("type", Type.class, "The type of the catalog");public static final Field COMMENT =@@ -34,7 +34,7 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIden@Getter protected Long id;- @Getter protected Long lakehouseId;+ @Getter protected Long metalakeId;protected String name;@@ -63,7 +63,7 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIdenpublic Map<Field, Object> fields() {Map<Field, Object> fields = new HashMap<>();fields.put(ID, id);- fields.put(LAKEHOUSE_ID, lakehouseId);+ fields.put(METALAKE_ID, metalakeId);fields.put(NAME, name);fields.put(COMMENT, comment);fields.put(TYPE, type);@@ -106,7 +106,7 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIdeninterface Builder<SELF extends Builder<SELF, T>, T extends BaseCatalog> {SELF withId(Long id);- SELF withLakehouseId(Long lakehouseId);+ SELF withMetalakeId(Long metalakeId);SELF withName(String name);@@ -127,7 +127,7 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIdenSELF extends Builder<SELF, T>, T extends BaseCatalog>implements Builder<SELF, T> {protected Long id;- protected Long lakehouseId;+ protected Long metalakeId;protected String name;protected Namespace namespace;protected Type type;@@ -142,8 +142,8 @@ public abstract class BaseCatalog implements Catalog, Entity, Auditable, HasIden}@Override- public SELF withLakehouseId(Long lakehouseId) {- this.lakehouseId = lakehouseId;+ public SELF withMetalakeId(Long metalakeId) {+ this.metalakeId = metalakeId;return self();}diff --git a/core/src/main/java/com/datastrato/graviton/meta/BaseCatalogsOperations.java b/core/src/main/java/com/datastrato/graviton/meta/BaseCatalogsOperations.javaindex f767537bed..d0e64ffcf9 100644--- a/core/src/main/java/com/datastrato/graviton/meta/BaseCatalogsOperations.java+++ b/core/src/main/java/com/datastrato/graviton/meta/BaseCatalogsOperations.java@@ -3,13 +3,13 @@ package com.datastrato.graviton.meta;import com.datastrato.graviton.*;import com.datastrato.graviton.exceptions.CatalogAlreadyExistsException;import com.datastrato.graviton.exceptions.NoSuchCatalogException;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;import java.util.Map;public class BaseCatalogsOperations implements SupportCatalogs {@Override- public Catalog[] listCatalogs(Namespace namespace) throws NoSuchLakehouseException {+ public Catalog[] listCatalogs(Namespace namespace) throws NoSuchMetalakeException {throw new UnsupportedOperationException("Not implemented yet");}@@ -21,7 +21,7 @@ public class BaseCatalogsOperations implements SupportCatalogs {@Overridepublic Catalog createCatalog(NameIdentifier ident, Catalog.Type type, String comment, Map<String, String> properties)- throws NoSuchLakehouseException, CatalogAlreadyExistsException {+ throws NoSuchMetalakeException, CatalogAlreadyExistsException {throw new UnsupportedOperationException("Not implemented yet");}diff --git a/core/src/main/java/com/datastrato/graviton/meta/BaseLakehousesOperations.java b/core/src/main/java/com/datastrato/graviton/meta/BaseLakehousesOperations.javadeleted file mode 100644index 6c211116b0..0000000000--- a/core/src/main/java/com/datastrato/graviton/meta/BaseLakehousesOperations.java+++ /dev/null@@ -1,37 +0,0 @@-package com.datastrato.graviton.meta;--import com.datastrato.graviton.*;-import com.datastrato.graviton.exceptions.LakehouseAlreadyExistsException;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;-import java.util.Map;--public class BaseLakehousesOperations implements SupportLakehouses {-- @Override- public BaseLakehouse[] listLakehouses() {- throw new UnsupportedOperationException("Not implemented yet");- }-- @Override- public BaseLakehouse loadLakehouse(NameIdentifier ident) throws NoSuchLakehouseException {- throw new UnsupportedOperationException("Not implemented yet");- }-- @Override- public BaseLakehouse createLakehouse(- NameIdentifier ident, String comment, Map<String, String> properties)- throws LakehouseAlreadyExistsException {- throw new UnsupportedOperationException("Not implemented yet");- }-- @Override- public BaseLakehouse alterLakehouse(NameIdentifier ident, LakehouseChange... changes)- throws NoSuchLakehouseException, IllegalArgumentException {- throw new UnsupportedOperationException("Not implemented yet");- }-- @Override- public boolean dropLakehouse(NameIdentifier ident) {- throw new UnsupportedOperationException("Not implemented yet");- }-}diff --git a/core/src/main/java/com/datastrato/graviton/meta/BaseLakehouse.java b/core/src/main/java/com/datastrato/graviton/meta/BaseMetalake.javasimilarity index 75%rename from core/src/main/java/com/datastrato/graviton/meta/BaseLakehouse.javarename to core/src/main/java/com/datastrato/graviton/meta/BaseMetalake.javaindex 5665a2bdf4..75574b5876 100644--- a/core/src/main/java/com/datastrato/graviton/meta/BaseLakehouse.java+++ b/core/src/main/java/com/datastrato/graviton/meta/BaseMetalake.java@@ -11,20 +11,19 @@ import lombok.ToString;@EqualsAndHashCode@ToString-public class BaseLakehouse implements Lakehouse, Entity, Auditable, HasIdentifier {+public class BaseMetalake implements Metalake, Entity, Auditable, HasIdentifier {public static final Field ID =- Field.required("id", Long.class, "The unique identifier of the lakehouse");- public static final Field NAME =- Field.required("name", String.class, "The name of the lakehouse");+ Field.required("id", Long.class, "The unique identifier of the metalake");+ public static final Field NAME = Field.required("name", String.class, "The name of the metalake");public static final Field COMMENT =- Field.optional("comment", String.class, "The comment of the lakehouse");+ Field.optional("comment", String.class, "The comment of the metalake");public static final Field PROPERTIES =- Field.optional("properties", Map.class, "The properties of the lakehouse");+ Field.optional("properties", Map.class, "The properties of the metalake");public static final Field AUDIT_INFO =- Field.required("audit_info", AuditInfo.class, "The audit info of the lakehouse");+ Field.required("audit_info", AuditInfo.class, "The audit info of the metalake");public static final Field SCHEMA_VERSION =- Field.required("version", SchemaVersion.class, "The schema version of the lakehouse");+ Field.required("version", SchemaVersion.class, "The schema version of the metalake");@Getter private Long id;@@ -38,7 +37,7 @@ public class BaseLakehouse implements Lakehouse, Entity, Auditable, HasIdentifie@Getter SchemaVersion version;- private BaseLakehouse() {}+ private BaseMetalake() {}@Overridepublic Map<Field, Object> fields() {@@ -74,45 +73,45 @@ public class BaseLakehouse implements Lakehouse, Entity, Auditable, HasIdentifie}public static class Builder {- private final BaseLakehouse lakehouse;+ private final BaseMetalake metalake;public Builder() {- lakehouse = new BaseLakehouse();+ metalake = new BaseMetalake();}public Builder withId(Long id) {- lakehouse.id = id;+ metalake.id = id;return this;}public Builder withName(String name) {- lakehouse.name = name;+ metalake.name = name;return this;}public Builder withComment(String comment) {- lakehouse.comment = comment;+ metalake.comment = comment;return this;}public Builder withProperties(Map<String, String> properties) {- lakehouse.properties = properties;+ metalake.properties = properties;return this;}public Builder withAuditInfo(AuditInfo auditInfo) {- lakehouse.auditInfo = auditInfo;+ metalake.auditInfo = auditInfo;return this;}public Builder withVersion(SchemaVersion version) {- lakehouse.version = version;+ metalake.version = version;return this;}- public BaseLakehouse build() {- lakehouse.validate();- return lakehouse;+ public BaseMetalake build() {+ metalake.validate();+ return metalake;}}}diff --git a/core/src/main/java/com/datastrato/graviton/meta/BaseMetalakesOperations.java b/core/src/main/java/com/datastrato/graviton/meta/BaseMetalakesOperations.javanew file mode 100644index 0000000000..f433c18538--- /dev/null+++ b/core/src/main/java/com/datastrato/graviton/meta/BaseMetalakesOperations.java@@ -0,0 +1,37 @@+package com.datastrato.graviton.meta;++import com.datastrato.graviton.*;+import com.datastrato.graviton.exceptions.MetalakeAlreadyExistsException;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;+import java.util.Map;++public class BaseMetalakesOperations implements SupportMetalakes {++ @Override+ public BaseMetalake[] listMetalakes() {+ throw new UnsupportedOperationException("Not implemented yet");+ }++ @Override+ public BaseMetalake loadMetalake(NameIdentifier ident) throws NoSuchMetalakeException {+ throw new UnsupportedOperationException("Not implemented yet");+ }++ @Override+ public BaseMetalake createMetalake(+ NameIdentifier ident, String comment, Map<String, String> properties)+ throws MetalakeAlreadyExistsException {+ throw new UnsupportedOperationException("Not implemented yet");+ }++ @Override+ public BaseMetalake alterMetalake(NameIdentifier ident, MetalakeChange... changes)+ throws NoSuchMetalakeException, IllegalArgumentException {+ throw new UnsupportedOperationException("Not implemented yet");+ }++ @Override+ public boolean dropMetalake(NameIdentifier ident) {+ throw new UnsupportedOperationException("Not implemented yet");+ }+}diff --git a/core/src/main/java/com/datastrato/graviton/proto/BaseLakehouseSerDe.java b/core/src/main/java/com/datastrato/graviton/proto/BaseLakehouseSerDe.javadeleted file mode 100644index 29e10ed67e..0000000000--- a/core/src/main/java/com/datastrato/graviton/proto/BaseLakehouseSerDe.java+++ /dev/null@@ -1,57 +0,0 @@-package com.datastrato.graviton.proto;--import com.datastrato.graviton.meta.AuditInfo;--class BaseLakehouseSerDe- implements ProtoSerDe<com.datastrato.graviton.meta.BaseLakehouse, Lakehouse> {- @Override- public Lakehouse serialize(com.datastrato.graviton.meta.BaseLakehouse baseLakehouse) {- Lakehouse.Builder builder =- Lakehouse.newBuilder()- .setId(baseLakehouse.getId())- .setName(baseLakehouse.name())- .setAuditInfo(new AuditInfoSerDe().serialize((AuditInfo) baseLakehouse.auditInfo()));-- if (baseLakehouse.comment() != null) {- builder.setComment(baseLakehouse.comment());- }-- if (baseLakehouse.properties() != null && !baseLakehouse.properties().isEmpty()) {- builder.putAllProperties(baseLakehouse.properties());- }-- SchemaVersion version =- SchemaVersion.newBuilder()- .setMajorNumber(baseLakehouse.getVersion().majorVersion)- .setMinorNumber(baseLakehouse.getVersion().minorVersion)- .build();- builder.setVersion(version);-- return builder.build();- }-- @Override- public com.datastrato.graviton.meta.BaseLakehouse deserialize(Lakehouse p) {- com.datastrato.graviton.meta.BaseLakehouse.Builder builder =- new com.datastrato.graviton.meta.BaseLakehouse.Builder();- builder- .withId(p.getId())- .withName(p.getName())- .withAuditInfo(new AuditInfoSerDe().deserialize(p.getAuditInfo()));-- if (p.hasComment()) {- builder.withComment(p.getComment());- }-- if (p.getPropertiesCount() > 0) {- builder.withProperties(p.getPropertiesMap());- }-- com.datastrato.graviton.meta.SchemaVersion version =- com.datastrato.graviton.meta.SchemaVersion.forValues(- p.getVersion().getMajorNumber(), p.getVersion().getMinorNumber());- builder.withVersion(version);-- return builder.build();- }-}diff --git a/core/src/main/java/com/datastrato/graviton/proto/BaseMetalakeSerDe.java b/core/src/main/java/com/datastrato/graviton/proto/BaseMetalakeSerDe.javanew file mode 100644index 0000000000..5620ad00c8--- /dev/null+++ b/core/src/main/java/com/datastrato/graviton/proto/BaseMetalakeSerDe.java@@ -0,0 +1,56 @@+package com.datastrato.graviton.proto;++import com.datastrato.graviton.meta.AuditInfo;++class BaseMetalakeSerDe implements ProtoSerDe<com.datastrato.graviton.meta.BaseMetalake, Metalake> {+ @Override+ public Metalake serialize(com.datastrato.graviton.meta.BaseMetalake baseMetalake) {+ Metalake.Builder builder =+ Metalake.newBuilder()+ .setId(baseMetalake.getId())+ .setName(baseMetalake.name())+ .setAuditInfo(new AuditInfoSerDe().serialize((AuditInfo) baseMetalake.auditInfo()));++ if (baseMetalake.comment() != null) {+ builder.setComment(baseMetalake.comment());+ }++ if (baseMetalake.properties() != null && !baseMetalake.properties().isEmpty()) {+ builder.putAllProperties(baseMetalake.properties());+ }++ SchemaVersion version =+ SchemaVersion.newBuilder()+ .setMajorNumber(baseMetalake.getVersion().majorVersion)+ .setMinorNumber(baseMetalake.getVersion().minorVersion)+ .build();+ builder.setVersion(version);++ return builder.build();+ }++ @Override+ public com.datastrato.graviton.meta.BaseMetalake deserialize(Metalake p) {+ com.datastrato.graviton.meta.BaseMetalake.Builder builder =+ new com.datastrato.graviton.meta.BaseMetalake.Builder();+ builder+ .withId(p.getId())+ .withName(p.getName())+ .withAuditInfo(new AuditInfoSerDe().deserialize(p.getAuditInfo()));++ if (p.hasComment()) {+ builder.withComment(p.getComment());+ }++ if (p.getPropertiesCount() > 0) {+ builder.withProperties(p.getPropertiesMap());+ }++ com.datastrato.graviton.meta.SchemaVersion version =+ com.datastrato.graviton.meta.SchemaVersion.forValues(+ p.getVersion().getMajorNumber(), p.getVersion().getMinorNumber());+ builder.withVersion(version);++ return builder.build();+ }+}diff --git a/core/src/main/java/com/datastrato/graviton/proto/ProtoEntitySerDe.java b/core/src/main/java/com/datastrato/graviton/proto/ProtoEntitySerDe.javaindex dc7328381e..19a6afccb6 100644--- a/core/src/main/java/com/datastrato/graviton/proto/ProtoEntitySerDe.java+++ b/core/src/main/java/com/datastrato/graviton/proto/ProtoEntitySerDe.java@@ -18,13 +18,13 @@ public class ProtoEntitySerDe implements EntitySerDe {ImmutableMap.of("com.datastrato.graviton.meta.AuditInfo","com.datastrato.graviton.proto.AuditInfoSerDe",- "com.datastrato.graviton.meta.BaseLakehouse",- "com.datastrato.graviton.proto.BaseLakehouseSerDe");+ "com.datastrato.graviton.meta.BaseMetalake",+ "com.datastrato.graviton.proto.BaseMetalakeSerDe");private static final Map<String, String> ENTITY_TO_PROTO =ImmutableMap.of("com.datastrato.graviton.meta.AuditInfo", "com.datastrato.graviton.proto.AuditInfo",- "com.datastrato.graviton.meta.BaseLakehouse", "com.datastrato.graviton.proto.Lakehouse");+ "com.datastrato.graviton.meta.BaseMetalake", "com.datastrato.graviton.proto.Metalake");private final Map<Class<? extends Entity>, ProtoSerDe<? extends Entity, ? extends Message>>entityToSerDe;diff --git a/core/src/test/java/com/datastrato/graviton/TestCatalog.java b/core/src/test/java/com/datastrato/graviton/TestCatalog.javaindex 3330d5e018..5b42200ed8 100644--- a/core/src/test/java/com/datastrato/graviton/TestCatalog.java+++ b/core/src/test/java/com/datastrato/graviton/TestCatalog.java@@ -84,7 +84,7 @@ public class TestCatalog extends BaseCatalog implements TableCatalog {@Overrideprotected TestCatalog internalBuild() {testCatalog.id = id;- testCatalog.lakehouseId = lakehouseId;+ testCatalog.metalakeId = metalakeId;testCatalog.name = name;testCatalog.namespace = namespace;testCatalog.type = type;diff --git a/core/src/test/java/com/datastrato/graviton/TestEntityStore.java b/core/src/test/java/com/datastrato/graviton/TestEntityStore.javaindex 13f056ec51..0105a0cd7f 100644--- a/core/src/test/java/com/datastrato/graviton/TestEntityStore.java+++ b/core/src/test/java/com/datastrato/graviton/TestEntityStore.java@@ -48,10 +48,10 @@ public class TestEntityStore {AuditInfo auditInfo =new AuditInfo.Builder().withCreator("creator").withCreateTime(Instant.now()).build();- BaseLakehouse lakehouse =- new BaseLakehouse.Builder()+ BaseMetalake metalake =+ new BaseMetalake.Builder().withId(1L)- .withName("lakehouse")+ .withName("metalake").withAuditInfo(auditInfo).withVersion(SchemaVersion.V_0_1).build();@@ -60,9 +60,9 @@ public class TestEntityStore {new TestCatalog.Builder().withId(1L).withName("catalog")- .withNamespace(Namespace.of("lakehouse"))+ .withNamespace(Namespace.of("metalake")).withType(TestCatalog.Type.RELATIONAL)- .withLakehouseId(1L)+ .withMetalakeId(1L).withAuditInfo(auditInfo).build();@@ -71,20 +71,20 @@ public class TestEntityStore {TestTable table =new TestTable("table",- Namespace.of("lakehouse", "catalog", "db"),+ Namespace.of("metalake", "catalog", "db"),"comment",Maps.newHashMap(),auditInfo,new Column[] {column});InMemoryEntityStore store = new InMemoryEntityStore();- store.storeEntity(lakehouse);+ store.storeEntity(metalake);store.storeEntity(catalog);store.storeEntity(table);store.storeEntity(column);- Lakehouse retrievedLakehouse = store.retrieveEntity(lakehouse);- Assertions.assertEquals(lakehouse, retrievedLakehouse);+ Metalake retrievedMetalake = store.retrieveEntity(metalake);+ Assertions.assertEquals(metalake, retrievedMetalake);BaseCatalog retrievedCatalog = store.retrieveEntity(catalog);Assertions.assertEquals(catalog, retrievedCatalog);diff --git a/core/src/test/java/com/datastrato/graviton/meta/TestEntity.java b/core/src/test/java/com/datastrato/graviton/meta/TestEntity.javaindex 5c2270eda7..f833dcae47 100644--- a/core/src/test/java/com/datastrato/graviton/meta/TestEntity.java+++ b/core/src/test/java/com/datastrato/graviton/meta/TestEntity.java@@ -15,9 +15,9 @@ public class TestEntity {private final AuditInfo auditInfo =new AuditInfo.Builder().withCreator("test").withCreateTime(now).build();- // Lakehouse test data- private final Long lakehouseId = 1L;- private final String lakehouseName = "testLakehouse";+ // Metalake test data+ private final Long metalakeId = 1L;+ private final String metalakeName = "testMetalake";private final Map<String, String> map = ImmutableMap.of("k1", "v1", "k2", "v2");// Catalog test data@@ -27,23 +27,23 @@ public class TestEntity {private final String catalogComment = "testComment";@Test- public void testLakehouse() {- BaseLakehouse lakehouse =- new BaseLakehouse.Builder()- .withId(lakehouseId)- .withName(lakehouseName)+ public void testMetalake() {+ BaseMetalake metalake =+ new BaseMetalake.Builder()+ .withId(metalakeId)+ .withName(metalakeName).withAuditInfo(auditInfo).withProperties(map).withVersion(version).build();- Map<Field, Object> fields = lakehouse.fields();- Assertions.assertEquals(lakehouseId, fields.get(BaseLakehouse.ID));- Assertions.assertEquals(lakehouseName, fields.get(BaseLakehouse.NAME));- Assertions.assertEquals(map, fields.get(BaseLakehouse.PROPERTIES));- Assertions.assertEquals(auditInfo, fields.get(BaseLakehouse.AUDIT_INFO));- Assertions.assertNull(fields.get(BaseLakehouse.COMMENT));- Assertions.assertEquals(version, fields.get(BaseLakehouse.SCHEMA_VERSION));+ Map<Field, Object> fields = metalake.fields();+ Assertions.assertEquals(metalakeId, fields.get(BaseMetalake.ID));+ Assertions.assertEquals(metalakeName, fields.get(BaseMetalake.NAME));+ Assertions.assertEquals(map, fields.get(BaseMetalake.PROPERTIES));+ Assertions.assertEquals(auditInfo, fields.get(BaseMetalake.AUDIT_INFO));+ Assertions.assertNull(fields.get(BaseMetalake.COMMENT));+ Assertions.assertEquals(version, fields.get(BaseMetalake.SCHEMA_VERSION));}@Test@@ -51,7 +51,7 @@ public class TestEntity {TestCatalog testCatalog =new TestCatalog.Builder().withId(catalogId)- .withLakehouseId(lakehouseId)+ .withMetalakeId(metalakeId).withName(catalogName).withComment(catalogComment).withType(type)@@ -61,7 +61,7 @@ public class TestEntity {Map<Field, Object> fields = testCatalog.fields();Assertions.assertEquals(catalogId, fields.get(TestCatalog.ID));- Assertions.assertEquals(lakehouseId, fields.get(TestCatalog.LAKEHOUSE_ID));+ Assertions.assertEquals(metalakeId, fields.get(TestCatalog.METALAKE_ID));Assertions.assertEquals(catalogName, fields.get(TestCatalog.NAME));Assertions.assertEquals(catalogComment, fields.get(TestCatalog.COMMENT));Assertions.assertEquals(type, fields.get(TestCatalog.TYPE));diff --git a/core/src/test/java/com/datastrato/graviton/proto/TestEntityProtoSerDe.java b/core/src/test/java/com/datastrato/graviton/proto/TestEntityProtoSerDe.javaindex 8d92dd6bbc..519b890d2f 100644--- a/core/src/test/java/com/datastrato/graviton/proto/TestEntityProtoSerDe.java+++ b/core/src/test/java/com/datastrato/graviton/proto/TestEntityProtoSerDe.java@@ -69,8 +69,8 @@ public class TestEntityProtoSerDe {String creator = "creator";Integer tenantId = 1;SchemaVersion version = SchemaVersion.V_0_1;- Long lakehouseId = 1L;- String lakehouseName = "lakehouse";+ Long metalakeId = 1L;+ String metalakeName = "metalake";Map<String, String> props = ImmutableMap.of("k1", "v1", "k2", "v2");com.datastrato.graviton.meta.AuditInfo auditInfo =@@ -79,11 +79,11 @@ public class TestEntityProtoSerDe {.withCreateTime(now).build();- // Test Lakehouse- com.datastrato.graviton.meta.BaseLakehouse lakehouse =- new com.datastrato.graviton.meta.BaseLakehouse.Builder()- .withId(lakehouseId)- .withName(lakehouseName)+ // Test Metalake+ com.datastrato.graviton.meta.BaseMetalake metalake =+ new com.datastrato.graviton.meta.BaseMetalake.Builder()+ .withId(metalakeId)+ .withName(metalakeName).withProperties(props).withAuditInfo(auditInfo).withVersion(version)@@ -91,36 +91,36 @@ public class TestEntityProtoSerDe {ProtoEntitySerDe protoEntitySerDe = (ProtoEntitySerDe) entitySerDe;- Lakehouse lakehouseProto = protoEntitySerDe.toProto(lakehouse);- Assertions.assertEquals(props, lakehouseProto.getPropertiesMap());- com.datastrato.graviton.meta.BaseLakehouse lakehouseFromProto =- protoEntitySerDe.fromProto(lakehouseProto);- Assertions.assertEquals(lakehouse, lakehouseFromProto);+ Metalake metalakeProto = protoEntitySerDe.toProto(metalake);+ Assertions.assertEquals(props, metalakeProto.getPropertiesMap());+ com.datastrato.graviton.meta.BaseMetalake metalakeFromProto =+ protoEntitySerDe.fromProto(metalakeProto);+ Assertions.assertEquals(metalake, metalakeFromProto);- byte[] lakehouseBytes = protoEntitySerDe.serialize(lakehouse);- com.datastrato.graviton.meta.BaseLakehouse lakehouseFromBytes =+ byte[] metalakeBytes = protoEntitySerDe.serialize(metalake);+ com.datastrato.graviton.meta.BaseMetalake metalakeFromBytes =protoEntitySerDe.deserialize(- lakehouseBytes, com.datastrato.graviton.meta.BaseLakehouse.class);- Assertions.assertEquals(lakehouse, lakehouseFromBytes);-- // Test Lakehouse without props map- com.datastrato.graviton.meta.BaseLakehouse lakehouse1 =- new com.datastrato.graviton.meta.BaseLakehouse.Builder()- .withId(lakehouseId)- .withName(lakehouseName)+ metalakeBytes, com.datastrato.graviton.meta.BaseMetalake.class);+ Assertions.assertEquals(metalake, metalakeFromBytes);++ // Test metalake without props map+ com.datastrato.graviton.meta.BaseMetalake metalake1 =+ new com.datastrato.graviton.meta.BaseMetalake.Builder()+ .withId(metalakeId)+ .withName(metalakeName).withAuditInfo(auditInfo).withVersion(version).build();- Lakehouse lakehouseProto1 = protoEntitySerDe.toProto(lakehouse1);- Assertions.assertEquals(0, lakehouseProto1.getPropertiesCount());- com.datastrato.graviton.meta.BaseLakehouse lakehouseFromProto1 =- protoEntitySerDe.fromProto(lakehouseProto1);- Assertions.assertEquals(lakehouse1, lakehouseFromProto1);+ Metalake metalakeProto1 = protoEntitySerDe.toProto(metalake1);+ Assertions.assertEquals(0, metalakeProto1.getPropertiesCount());+ com.datastrato.graviton.meta.BaseMetalake metalakeFromProto1 =+ protoEntitySerDe.fromProto(metalakeProto1);+ Assertions.assertEquals(metalake1, metalakeFromProto1);- byte[] lakehouseBytes1 = entitySerDe.serialize(lakehouse1);- com.datastrato.graviton.meta.BaseLakehouse lakehouseFromBytes1 =- entitySerDe.deserialize(lakehouseBytes1, com.datastrato.graviton.meta.BaseLakehouse.class);- Assertions.assertEquals(lakehouse1, lakehouseFromBytes1);+ byte[] metalakeBytes1 = entitySerDe.serialize(metalake1);+ com.datastrato.graviton.meta.BaseMetalake metalakeFromBytes1 =+ entitySerDe.deserialize(metalakeBytes1, com.datastrato.graviton.meta.BaseMetalake.class);+ Assertions.assertEquals(metalake1, metalakeFromBytes1);}}diff --git a/meta/src/main/proto/graviton_meta.proto b/meta/src/main/proto/graviton_meta.protoindex d094cdbb50..3338eec5cf 100644--- a/meta/src/main/proto/graviton_meta.proto+++ b/meta/src/main/proto/graviton_meta.proto@@ -25,10 +25,10 @@ message AuditInfo {}/**- * The Lakehouse message is used to record the lakehouse information. Lakehouse is used track all+ * The Metalake message is used to record the Metalake information. Metalake is used track allthe metadata of the data lake, data warehouse, and data mart.*/-message Lakehouse {+message Metalake {uint64 id = 1;string name = 2;optional string comment = 3;@@ -45,7 +45,7 @@ message Catalog {}uint64 id = 1;- uint64 lakehouse_id = 2;+ uint64 metalake_id = 2;string name = 3;Type type = 4;optional string comment = 5;diff --git a/rfc/rfc-1/rfc-1.md b/rfc/rfc-1/rfc-1.mdindex a7488f4063..00e9f98178 100644--- a/rfc/rfc-1/rfc-1.md+++ b/rfc/rfc-1/rfc-1.md@@ -52,7 +52,7 @@ The schema system in Graviton is organized like below:-1. **Lakehouse**: lakehouse is a top-level container that manages all the metadata from DB/EDW, Hive/Iceberg/Hudi, plain files, MQ and others.+1. **Metalake**: metalake is a top-level container that manages all the metadata from DB/EDW, Hive/Iceberg/Hudi, plain files, MQ and others.2. **Catalog**: catalog is a collection of metadata from a specific metadata source. For example, “hive.db.table” means this table belongs to Hive catalog under the DB “db”.3. **Connector**: connector is 1 to 1 mapping to catalog, 1 connector is binding to 1 catalog, and 1 catalog only has 1 connector. The connector defines how to connect the underlying metadata source.4. **Metadata Structure**: metadata structure is defined per metadata source. For example, JDBC and Hive catalog follow “db.table” pattern, file catalog follows “scheme:///<file_path>” pattern.@@ -73,15 +73,15 @@ The schema system in Graviton is organized like below:| last_modifier | string | The name of user who modified the schema entity last time | Optional || last_modified_time | timestamp | Google Protobuf timestamp type to represent when entity is modified | Optional |-#### Lakehouse+#### Metalake| Field Name | Field Type | Description | Optional || ---------- | ------------------- | ------------------------------------------------------------ | -------- |-| id | uint64 | The unique identifier of the lakehouse, this is generated by the system | Required |-| name | string | The name of the lakehouse | Required |-| comment | string | The comment of the lakehouse | Optional |-| properties | map<string, string> | The properties of the lakehouse | Optional |-| audit_info | AuditInfo | The detailed audit info of lakehouse | Required |+| id | uint64 | The unique identifier of the metalake, this is generated by the system | Required |+| name | string | The name of the metalake | Required |+| comment | string | The comment of the metalake | Optional |+| properties | map<string, string> | The properties of the metalake | Optional |+| audit_info | AuditInfo | The detailed audit info of metalake | Required || version | SchemaVersion | The version info of the stored schema | Required |#### Catalog@@ -89,7 +89,7 @@ The schema system in Graviton is organized like below:| Field Name | Field Type | Description | Optional || ------------ | -------------------------------------- | ------------------------------------------------------------ | -------- || id | uint64 | The unique identifier of the catalog, this is generated by the system | Required |-| lakehouse_id | uint64 | The unique identifier of the lakehouse which includes this catalog | Required |+| metalake_id | uint64 | The unique identifier of the metalake which includes this catalog | Required || name | string | The name of the catalog | Required || comment | string | The comment of the catalog | Required || type | Enum of {RELATIONAL, FILE, STREAM, ML} | The type of the catalog, currently we support is "RELATIONAL" (catalog for relational data structure) | Required |diff --git a/server/src/main/java/com/datastrato/graviton/server/GravitonServer.java b/server/src/main/java/com/datastrato/graviton/server/GravitonServer.javaindex 92278d6784..e10939c7c1 100644--- a/server/src/main/java/com/datastrato/graviton/server/GravitonServer.java+++ b/server/src/main/java/com/datastrato/graviton/server/GravitonServer.java@@ -1,6 +1,6 @@package com.datastrato.graviton.server;-import com.datastrato.graviton.meta.BaseLakehousesOperations;+import com.datastrato.graviton.meta.BaseMetalakesOperations;import com.datastrato.graviton.server.web.JettyServer;import com.datastrato.graviton.server.web.ObjectMapperProvider;import com.datastrato.graviton.server.web.VersioningFilter;@@ -47,7 +47,7 @@ public class GravitonServer extends ResourceConfig {new AbstractBinder() {@Overrideprotected void configure() {- bind(BaseLakehousesOperations.class).to(BaseLakehousesOperations.class).ranked(1);+ bind(BaseMetalakesOperations.class).to(BaseMetalakesOperations.class).ranked(1);}});register(ObjectMapperProvider.class).register(JacksonFeature.class);diff --git a/server/src/main/java/com/datastrato/graviton/server/web/rest/DTOConverters.java b/server/src/main/java/com/datastrato/graviton/server/web/rest/DTOConverters.javaindex 1c978823b5..50e40362a8 100644--- a/server/src/main/java/com/datastrato/graviton/server/web/rest/DTOConverters.java+++ b/server/src/main/java/com/datastrato/graviton/server/web/rest/DTOConverters.java@@ -1,9 +1,9 @@package com.datastrato.graviton.server.web.rest;import com.datastrato.graviton.Audit;-import com.datastrato.graviton.Lakehouse;+import com.datastrato.graviton.Metalake;import com.datastrato.graviton.dto.AuditDTO;-import com.datastrato.graviton.dto.LakehouseDTO;+import com.datastrato.graviton.dto.MetalakeDTO;public class DTOConverters {@@ -18,12 +18,12 @@ public class DTOConverters {.build();}- public static LakehouseDTO toDTO(Lakehouse lakehouse) {- return LakehouseDTO.builder()- .withName(lakehouse.name())- .withComment(lakehouse.comment())- .withProperties(lakehouse.properties())- .withAudit(toDTO(lakehouse.auditInfo()))+ public static MetalakeDTO toDTO(Metalake metalake) {+ return MetalakeDTO.builder()+ .withName(metalake.name())+ .withComment(metalake.comment())+ .withProperties(metalake.properties())+ .withAudit(toDTO(metalake.auditInfo())).build();}}diff --git a/server/src/main/java/com/datastrato/graviton/server/web/rest/LakehouseOperations.java b/server/src/main/java/com/datastrato/graviton/server/web/rest/LakehouseOperations.javadeleted file mode 100644index 2b6496a1c4..0000000000--- a/server/src/main/java/com/datastrato/graviton/server/web/rest/LakehouseOperations.java+++ /dev/null@@ -1,145 +0,0 @@-package com.datastrato.graviton.server.web.rest;--import com.datastrato.graviton.LakehouseChange;-import com.datastrato.graviton.NameIdentifier;-import com.datastrato.graviton.dto.requests.LakehouseCreateRequest;-import com.datastrato.graviton.dto.requests.LakehouseUpdateRequest;-import com.datastrato.graviton.dto.requests.LakehouseUpdatesRequest;-import com.datastrato.graviton.dto.responses.LakehouseResponse;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;-import com.datastrato.graviton.meta.BaseLakehouse;-import com.datastrato.graviton.meta.BaseLakehousesOperations;-import com.datastrato.graviton.server.web.Utils;-import javax.inject.Inject;-import javax.servlet.http.HttpServletRequest;-import javax.ws.rs.*;-import javax.ws.rs.core.Context;-import javax.ws.rs.core.MediaType;-import javax.ws.rs.core.Response;-import org.slf4j.Logger;-import org.slf4j.LoggerFactory;--@Path("/lakehouses")-@Consumes(MediaType.APPLICATION_JSON)-@Produces(MediaType.APPLICATION_JSON)-public class LakehouseOperations {-- private static final Logger LOG = LoggerFactory.getLogger(LakehouseOperations.class);-- private final BaseLakehousesOperations ops;-- @Context private HttpServletRequest httpRequest;-- @Inject- public LakehouseOperations(BaseLakehousesOperations ops) {- this.ops = ops;- }-- @POST- @Produces("application/vnd.graviton.v1+json")- public Response create(LakehouseCreateRequest request) {- try {- request.validate();- } catch (IllegalArgumentException e) {- LOG.error("Failed to validate create Lakehouse arguments {}", request, e);-- return Utils.illegalArguments(e.getMessage());- }-- try {- NameIdentifier ident = NameIdentifier.parse(request.getName());- BaseLakehouse lakehouse =- ops.createLakehouse(ident, request.getComment(), request.getProperties());- return Utils.ok(new LakehouseResponse(DTOConverters.toDTO(lakehouse)));-- } catch (Exception e) {- LOG.error("Failed to create lakehouse", e);-- return Utils.internalError(e.getMessage());- }- }-- @GET- @Path("{name}")- @Produces("application/vnd.graviton.v1+json")- public Response get(@PathParam("name") String lakehouseName) {- if (lakehouseName == null || lakehouseName.isEmpty()) {- return Utils.illegalArguments("Tenant name is required");- }-- try {- NameIdentifier identifier = NameIdentifier.parse(lakehouseName);- BaseLakehouse lakehouse = ops.loadLakehouse(identifier);- return Utils.ok(new LakehouseResponse(DTOConverters.toDTO(lakehouse)));-- } catch (NoSuchLakehouseException e) {- LOG.warn("Failed to find lakehouse by name {}", lakehouseName);- return Utils.notFound("Failed to find lakehouse by name " + lakehouseName);-- } catch (Exception e) {- LOG.error("Failed to get lakehouse by name {}", lakehouseName, e);-- return Utils.internalError(e.getMessage());- }- }-- @PUT- @Path("{name}")- @Produces("application/vnd.graviton.v1+json")- public Response update(- @PathParam("name") String lakehouseName, LakehouseUpdatesRequest updatesRequest) {- if (lakehouseName == null || lakehouseName.isEmpty()) {- return Utils.illegalArguments("Lakehouse name is required");- }-- try {- updatesRequest.validate();- } catch (Exception e) {- LOG.error("Failed to validate update Lakehouse arguments {}", updatesRequest, e);- return Utils.illegalArguments(e.getMessage());- }-- try {- NameIdentifier identifier = NameIdentifier.parse(lakehouseName);- LakehouseChange[] changes =- updatesRequest.getRequests().stream()- .map(LakehouseUpdateRequest::lakehouseChange)- .toArray(LakehouseChange[]::new);-- BaseLakehouse updatedLakehouse = ops.alterLakehouse(identifier, changes);- return Utils.ok(new LakehouseResponse(DTOConverters.toDTO(updatedLakehouse)));-- } catch (NoSuchLakehouseException e) {- LOG.warn("Failed to find lakehouse by name {}", lakehouseName);- return Utils.notFound("Failed to find lakehouse by name " + lakehouseName);-- } catch (Exception e) {- LOG.error("Failed to update lakehouse by name {}", lakehouseName, e);- return Utils.internalError(e.getMessage());- }- }-- @DELETE- @Path("{name}")- @Produces("application/vnd.graviton.v1+json")- public Response delete(@PathParam("name") String lakehouseName) {- if (lakehouseName == null || lakehouseName.isEmpty()) {- return Utils.illegalArguments("Lakehouse name is required");- }-- try {- NameIdentifier identifier = NameIdentifier.parse(lakehouseName);- boolean dropped = ops.dropLakehouse(identifier);- if (dropped) {- return Utils.ok();- } else {- LOG.warn("Failed to delete lakehouse by name {}", lakehouseName);- return Utils.internalError("Failed to delete lakehouse by name " + lakehouseName);- }-- } catch (Exception e) {- LOG.error("Failed to delete lakehouse by name {}", lakehouseName, e);- return Utils.internalError(e.getMessage());- }- }-}diff --git a/server/src/main/java/com/datastrato/graviton/server/web/rest/MetalakeOperations.java b/server/src/main/java/com/datastrato/graviton/server/web/rest/MetalakeOperations.javanew file mode 100644index 0000000000..c52f13afd8--- /dev/null+++ b/server/src/main/java/com/datastrato/graviton/server/web/rest/MetalakeOperations.java@@ -0,0 +1,145 @@+package com.datastrato.graviton.server.web.rest;++import com.datastrato.graviton.MetalakeChange;+import com.datastrato.graviton.NameIdentifier;+import com.datastrato.graviton.dto.requests.MetalakeCreateRequest;+import com.datastrato.graviton.dto.requests.MetalakeUpdateRequest;+import com.datastrato.graviton.dto.requests.MetalakeUpdatesRequest;+import com.datastrato.graviton.dto.responses.MetalakeResponse;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;+import com.datastrato.graviton.meta.BaseMetalake;+import com.datastrato.graviton.meta.BaseMetalakesOperations;+import com.datastrato.graviton.server.web.Utils;+import javax.inject.Inject;+import javax.servlet.http.HttpServletRequest;+import javax.ws.rs.*;+import javax.ws.rs.core.Context;+import javax.ws.rs.core.MediaType;+import javax.ws.rs.core.Response;+import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++@Path("/metalakes")+@Consumes(MediaType.APPLICATION_JSON)+@Produces(MediaType.APPLICATION_JSON)+public class MetalakeOperations {++ private static final Logger LOG = LoggerFactory.getLogger(MetalakeOperations.class);++ private final BaseMetalakesOperations ops;++ @Context private HttpServletRequest httpRequest;++ @Inject+ public MetalakeOperations(BaseMetalakesOperations ops) {+ this.ops = ops;+ }++ @POST+ @Produces("application/vnd.graviton.v1+json")+ public Response create(MetalakeCreateRequest request) {+ try {+ request.validate();+ } catch (IllegalArgumentException e) {+ LOG.error("Failed to validate create Metalake arguments {}", request, e);++ return Utils.illegalArguments(e.getMessage());+ }++ try {+ NameIdentifier ident = NameIdentifier.parse(request.getName());+ BaseMetalake metalake =+ ops.createMetalake(ident, request.getComment(), request.getProperties());+ return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));++ } catch (Exception e) {+ LOG.error("Failed to create metalake", e);++ return Utils.internalError(e.getMessage());+ }+ }++ @GET+ @Path("{name}")+ @Produces("application/vnd.graviton.v1+json")+ public Response get(@PathParam("name") String metalakeName) {+ if (metalakeName == null || metalakeName.isEmpty()) {+ return Utils.illegalArguments("Tenant name is required");+ }++ try {+ NameIdentifier identifier = NameIdentifier.parse(metalakeName);+ BaseMetalake metalake = ops.loadMetalake(identifier);+ return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));++ } catch (NoSuchMetalakeException e) {+ LOG.warn("Failed to find metalake by name {}", metalakeName);+ return Utils.notFound("Failed to find metalake by name " + metalakeName);++ } catch (Exception e) {+ LOG.error("Failed to get metalake by name {}", metalakeName, e);++ return Utils.internalError(e.getMessage());+ }+ }++ @PUT+ @Path("{name}")+ @Produces("application/vnd.graviton.v1+json")+ public Response update(+ @PathParam("name") String metalakeName, MetalakeUpdatesRequest updatesRequest) {+ if (metalakeName == null || metalakeName.isEmpty()) {+ return Utils.illegalArguments("Metalake name is required");+ }++ try {+ updatesRequest.validate();+ } catch (Exception e) {+ LOG.error("Failed to validate update metalake arguments {}", updatesRequest, e);+ return Utils.illegalArguments(e.getMessage());+ }++ try {+ NameIdentifier identifier = NameIdentifier.parse(metalakeName);+ MetalakeChange[] changes =+ updatesRequest.getRequests().stream()+ .map(MetalakeUpdateRequest::metalakeChange)+ .toArray(MetalakeChange[]::new);++ BaseMetalake updatedmetalake = ops.alterMetalake(identifier, changes);+ return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(updatedmetalake)));++ } catch (NoSuchMetalakeException e) {+ LOG.warn("Failed to find metalake by name {}", metalakeName);+ return Utils.notFound("Failed to find metalake by name " + metalakeName);++ } catch (Exception e) {+ LOG.error("Failed to update metalake by name {}", metalakeName, e);+ return Utils.internalError(e.getMessage());+ }+ }++ @DELETE+ @Path("{name}")+ @Produces("application/vnd.graviton.v1+json")+ public Response delete(@PathParam("name") String metalakeName) {+ if (metalakeName == null || metalakeName.isEmpty()) {+ return Utils.illegalArguments("metalake name is required");+ }++ try {+ NameIdentifier identifier = NameIdentifier.parse(metalakeName);+ boolean dropped = ops.dropMetalake(identifier);+ if (dropped) {+ return Utils.ok();+ } else {+ LOG.warn("Failed to delete metalake by name {}", metalakeName);+ return Utils.internalError("Failed to delete metalake by name " + metalakeName);+ }++ } catch (Exception e) {+ LOG.error("Failed to delete metalake by name {}", metalakeName, e);+ return Utils.internalError(e.getMessage());+ }+ }+}diff --git a/server/src/test/java/com/datastrato/graviton/server/web/rest/TestLakehousesOperations.java b/server/src/test/java/com/datastrato/graviton/server/web/rest/TestMetalakesOperations.javasimilarity index 59%rename from server/src/test/java/com/datastrato/graviton/server/web/rest/TestLakehousesOperations.javarename to server/src/test/java/com/datastrato/graviton/server/web/rest/TestMetalakesOperations.javaindex 2fe8b3d917..b05d77195d 100644--- a/server/src/test/java/com/datastrato/graviton/server/web/rest/TestLakehousesOperations.java+++ b/server/src/test/java/com/datastrato/graviton/server/web/rest/TestMetalakesOperations.java@@ -3,18 +3,18 @@ package com.datastrato.graviton.server.web.rest;import static org.mockito.ArgumentMatchers.any;import static org.mockito.Mockito.*;-import com.datastrato.graviton.LakehouseChange;-import com.datastrato.graviton.dto.LakehouseDTO;-import com.datastrato.graviton.dto.requests.LakehouseCreateRequest;-import com.datastrato.graviton.dto.requests.LakehouseUpdateRequest;-import com.datastrato.graviton.dto.requests.LakehouseUpdatesRequest;+import com.datastrato.graviton.MetalakeChange;+import com.datastrato.graviton.dto.MetalakeDTO;+import com.datastrato.graviton.dto.requests.MetalakeCreateRequest;+import com.datastrato.graviton.dto.requests.MetalakeUpdateRequest;+import com.datastrato.graviton.dto.requests.MetalakeUpdatesRequest;import com.datastrato.graviton.dto.responses.BaseResponse;import com.datastrato.graviton.dto.responses.ErrorType;-import com.datastrato.graviton.dto.responses.LakehouseResponse;-import com.datastrato.graviton.exceptions.NoSuchLakehouseException;+import com.datastrato.graviton.dto.responses.MetalakeResponse;+import com.datastrato.graviton.exceptions.NoSuchMetalakeException;import com.datastrato.graviton.meta.AuditInfo;-import com.datastrato.graviton.meta.BaseLakehouse;-import com.datastrato.graviton.meta.BaseLakehousesOperations;+import com.datastrato.graviton.meta.BaseMetalake;+import com.datastrato.graviton.meta.BaseMetalakesOperations;import com.datastrato.graviton.meta.SchemaVersion;import com.google.common.collect.ImmutableMap;import com.google.common.collect.Lists;@@ -31,7 +31,7 @@ import org.glassfish.jersey.test.JerseyTest;import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.Test;-public class TestLakehousesOperations extends JerseyTest {+public class TestMetalakesOperations extends JerseyTest {private static class MockServletRequestFactory extends ServletRequestFactoryBase {@Override@@ -42,17 +42,17 @@ public class TestLakehousesOperations extends JerseyTest {}}- private BaseLakehousesOperations lakehousesOperations = mock(BaseLakehousesOperations.class);+ private BaseMetalakesOperations metalakesOperations = mock(BaseMetalakesOperations.class);@Overrideprotected Application configure() {ResourceConfig resourceConfig = new ResourceConfig();- resourceConfig.register(LakehouseOperations.class);+ resourceConfig.register(MetalakeOperations.class);resourceConfig.register(new AbstractBinder() {@Overrideprotected void configure() {- bind(lakehousesOperations).to(BaseLakehousesOperations.class).ranked(2);+ bind(metalakesOperations).to(BaseMetalakesOperations.class).ranked(2);bindFactory(MockServletRequestFactory.class).to(HttpServletRequest.class);}});@@ -61,15 +61,15 @@ public class TestLakehousesOperations extends JerseyTest {}@Test- public void testCreateLakehouse() {- LakehouseCreateRequest req =- new LakehouseCreateRequest("lakehouse", "comment", ImmutableMap.of("k1", "v1"));+ public void testCreateMetalake() {+ MetalakeCreateRequest req =+ new MetalakeCreateRequest("metalake", "comment", ImmutableMap.of("k1", "v1"));Instant now = Instant.now();- BaseLakehouse mockLakehouse =- new BaseLakehouse.Builder()+ BaseMetalake mockMetalake =+ new BaseMetalake.Builder().withId(1L)- .withName("lakehouse")+ .withName("metalake").withComment("comment").withProperties(ImmutableMap.of("k1", "v1")).withAuditInfo(@@ -77,10 +77,10 @@ public class TestLakehousesOperations extends JerseyTest {.withVersion(SchemaVersion.V_0_1).build();- when(lakehousesOperations.createLakehouse(any(), any(), any())).thenReturn(mockLakehouse);+ when(metalakesOperations.createMetalake(any(), any(), any())).thenReturn(mockMetalake);Response resp =- target("/lakehouses")+ target("/metalakes").request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").post(Entity.entity(req, MediaType.APPLICATION_JSON_TYPE));@@ -88,19 +88,19 @@ public class TestLakehousesOperations extends JerseyTest {Assertions.assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());Assertions.assertEquals(MediaType.APPLICATION_JSON_TYPE, resp.getMediaType());- LakehouseResponse lakehouseResponse = resp.readEntity(LakehouseResponse.class);- Assertions.assertEquals(0, lakehouseResponse.getCode());- Assertions.assertNull(lakehouseResponse.getMessage());- Assertions.assertNull(lakehouseResponse.getType());+ MetalakeResponse metalakeResponse = resp.readEntity(MetalakeResponse.class);+ Assertions.assertEquals(0, metalakeResponse.getCode());+ Assertions.assertNull(metalakeResponse.getMessage());+ Assertions.assertNull(metalakeResponse.getType());- LakehouseDTO lakehouse = lakehouseResponse.getLakehouse();- Assertions.assertEquals("lakehouse", lakehouse.name());- Assertions.assertEquals("comment", lakehouse.comment());- Assertions.assertEquals(ImmutableMap.of("k1", "v1"), lakehouse.properties());+ MetalakeDTO metalake = metalakeResponse.getMetalake();+ Assertions.assertEquals("metalake", metalake.name());+ Assertions.assertEquals("comment", metalake.comment());+ Assertions.assertEquals(ImmutableMap.of("k1", "v1"), metalake.properties());- LakehouseCreateRequest req1 = new LakehouseCreateRequest(null, null, null);+ MetalakeCreateRequest req1 = new MetalakeCreateRequest(null, null, null);Response resp1 =- target("/lakehouses")+ target("/metalakes").request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").post(Entity.entity(req1, MediaType.APPLICATION_JSON_TYPE));@@ -114,23 +114,23 @@ public class TestLakehousesOperations extends JerseyTest {}@Test- public void testGetLakehouse() {- String lakehouseName = "test";+ public void testGetMetalake() {+ String metalakeName = "test";Long id = 1L;Instant now = Instant.now();AuditInfo info = new AuditInfo.Builder().withCreator("graviton").withCreateTime(now).build();- BaseLakehouse lakehouse =- new BaseLakehouse.Builder()- .withName(lakehouseName)+ BaseMetalake metalake =+ new BaseMetalake.Builder()+ .withName(metalakeName).withId(id).withAuditInfo(info).withVersion(SchemaVersion.V_0_1).build();- when(lakehousesOperations.loadLakehouse(any())).thenReturn(lakehouse);+ when(metalakesOperations.loadMetalake(any())).thenReturn(metalake);Response resp =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").get();@@ -138,23 +138,23 @@ public class TestLakehousesOperations extends JerseyTest {Assertions.assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());Assertions.assertEquals(MediaType.APPLICATION_JSON_TYPE, resp.getMediaType());- LakehouseResponse lakehouseResponse = resp.readEntity(LakehouseResponse.class);- Assertions.assertEquals(0, lakehouseResponse.getCode());- Assertions.assertNull(lakehouseResponse.getMessage());- Assertions.assertNull(lakehouseResponse.getType());+ MetalakeResponse metalakeResponse = resp.readEntity(MetalakeResponse.class);+ Assertions.assertEquals(0, metalakeResponse.getCode());+ Assertions.assertNull(metalakeResponse.getMessage());+ Assertions.assertNull(metalakeResponse.getType());- LakehouseDTO lakehouse1 = lakehouseResponse.getLakehouse();- Assertions.assertEquals(lakehouseName, lakehouse1.name());- Assertions.assertNull(lakehouse1.comment());- Assertions.assertNull(lakehouse1.properties());+ MetalakeDTO metalake1 = metalakeResponse.getMetalake();+ Assertions.assertEquals(metalakeName, metalake1.name());+ Assertions.assertNull(metalake1.comment());+ Assertions.assertNull(metalake1.properties());- // Test when specified lakehouse is not found.- doThrow(new NoSuchLakehouseException("Failed to find lakehouse by name " + lakehouseName))- .when(lakehousesOperations)- .loadLakehouse(any());+ // Test when specified metalake is not found.+ doThrow(new NoSuchMetalakeException("Failed to find metalake by name " + metalakeName))+ .when(metalakesOperations)+ .loadMetalake(any());Response resp1 =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").get();@@ -165,13 +165,13 @@ public class TestLakehousesOperations extends JerseyTest {Assertions.assertEquals(ErrorType.NOT_FOUND.errorCode(), baseResponse.getCode());Assertions.assertEquals(ErrorType.NOT_FOUND.errorType(), baseResponse.getType());Assertions.assertEquals(- "Failed to find lakehouse by name " + lakehouseName, baseResponse.getMessage());+ "Failed to find metalake by name " + metalakeName, baseResponse.getMessage());// Test with internal error- doThrow(new RuntimeException("Internal error")).when(lakehousesOperations).loadLakehouse(any());+ doThrow(new RuntimeException("Internal error")).when(metalakesOperations).loadMetalake(any());Response resp2 =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").get();@@ -186,57 +186,57 @@ public class TestLakehousesOperations extends JerseyTest {}@Test- public void testUpdateLakehouse() {- String lakehouseName = "test";+ public void testUpdateMetalake() {+ String metalakeName = "test";Long id = 1L;Instant now = Instant.now();AuditInfo info = new AuditInfo.Builder().withCreator("graviton").withCreateTime(now).build();- BaseLakehouse lakehouse =- new BaseLakehouse.Builder()- .withName(lakehouseName)+ BaseMetalake metalake =+ new BaseMetalake.Builder()+ .withName(metalakeName).withId(id).withAuditInfo(info).withVersion(SchemaVersion.V_0_1).build();- List<LakehouseUpdateRequest> updateRequests =+ List<MetalakeUpdateRequest> updateRequests =Lists.newArrayList(- new LakehouseUpdateRequest.RenameLakehouseRequest("newTest"),- new LakehouseUpdateRequest.UpdateLakehouseCommentRequest("newComment"));- LakehouseChange[] changes =+ new MetalakeUpdateRequest.RenameMetalakeRequest("newTest"),+ new MetalakeUpdateRequest.UpdateMetalakeCommentRequest("newComment"));+ MetalakeChange[] changes =updateRequests.stream()- .map(LakehouseUpdateRequest::lakehouseChange)- .toArray(LakehouseChange[]::new);+ .map(MetalakeUpdateRequest::metalakeChange)+ .toArray(MetalakeChange[]::new);- when(lakehousesOperations.alterLakehouse(any(), any(), any())).thenReturn(lakehouse);+ when(metalakesOperations.alterMetalake(any(), any(), any())).thenReturn(metalake);- LakehouseUpdatesRequest req = new LakehouseUpdatesRequest(updateRequests);+ MetalakeUpdatesRequest req = new MetalakeUpdatesRequest(updateRequests);Response resp =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").put(Entity.entity(req, MediaType.APPLICATION_JSON_TYPE));Assertions.assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());- LakehouseResponse lakehouseResponse = resp.readEntity(LakehouseResponse.class);- Assertions.assertEquals(0, lakehouseResponse.getCode());- Assertions.assertNull(lakehouseResponse.getMessage());- Assertions.assertNull(lakehouseResponse.getType());+ MetalakeResponse metalakeResponse = resp.readEntity(MetalakeResponse.class);+ Assertions.assertEquals(0, metalakeResponse.getCode());+ Assertions.assertNull(metalakeResponse.getMessage());+ Assertions.assertNull(metalakeResponse.getType());- LakehouseDTO lakehouse1 = lakehouseResponse.getLakehouse();- Assertions.assertEquals(lakehouseName, lakehouse1.name());- Assertions.assertNull(lakehouse1.comment());- Assertions.assertNull(lakehouse1.properties());+ MetalakeDTO metalake1 = metalakeResponse.getMetalake();+ Assertions.assertEquals(metalakeName, metalake1.name());+ Assertions.assertNull(metalake1.comment());+ Assertions.assertNull(metalake1.properties());- // Test when specified lakehouse is not found.- doThrow(new NoSuchLakehouseException("Failed to find lakehouse by name " + lakehouseName))- .when(lakehousesOperations)- .alterLakehouse(any(), any(), any());+ // Test when specified metalake is not found.+ doThrow(new NoSuchMetalakeException("Failed to find metalake by name " + metalakeName))+ .when(metalakesOperations)+ .alterMetalake(any(), any(), any());Response resp1 =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").put(Entity.entity(req, MediaType.APPLICATION_JSON_TYPE));@@ -248,11 +248,11 @@ public class TestLakehousesOperations extends JerseyTest {// Test with internal errordoThrow(new RuntimeException("Internal error"))- .when(lakehousesOperations)- .alterLakehouse(any(), any(), any());+ .when(metalakesOperations)+ .alterMetalake(any(), any(), any());Response resp2 =- target("/lakehouses/" + lakehouseName)+ target("/metalakes/" + metalakeName).request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").put(Entity.entity(req, MediaType.APPLICATION_JSON_TYPE));@@ -265,10 +265,10 @@ public class TestLakehousesOperations extends JerseyTest {}@Test- public void testDeleteLakehouse() {- when(lakehousesOperations.dropLakehouse(any())).thenReturn(true);+ public void testDeleteMetalake() {+ when(metalakesOperations.dropMetalake(any())).thenReturn(true);Response resp =- target("/lakehouses/test")+ target("/metalakes/test").request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").delete();@@ -276,10 +276,10 @@ public class TestLakehousesOperations extends JerseyTest {Assertions.assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());// Test throw an exception when deleting tenant.- doThrow(new RuntimeException("Internal error")).when(lakehousesOperations).dropLakehouse(any());+ doThrow(new RuntimeException("Internal error")).when(metalakesOperations).dropMetalake(any());Response resp1 =- target("/lakehouses/test")+ target("/metalakes/test").request(MediaType.APPLICATION_JSON_TYPE).accept("application/vnd.graviton.v1+json").delete();