-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into iceberg-extended-sql
- Loading branch information
Showing
62 changed files
with
726 additions
and
611 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
api/src/main/java/com/datastrato/gravitino/rel/SupportsCatalogs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.rel; | ||
|
||
import com.datastrato.gravitino.Catalog; | ||
import com.datastrato.gravitino.CatalogChange; | ||
import com.datastrato.gravitino.CatalogProvider; | ||
import com.datastrato.gravitino.NameIdentifier; | ||
import com.datastrato.gravitino.annotation.Evolving; | ||
import com.datastrato.gravitino.exceptions.CatalogAlreadyExistsException; | ||
import com.datastrato.gravitino.exceptions.NoSuchCatalogException; | ||
import com.datastrato.gravitino.exceptions.NoSuchMetalakeException; | ||
import java.util.Map; | ||
|
||
/** | ||
* Client interface for supporting catalogs. It includes methods for listing, loading, creating, | ||
* altering and dropping catalogs. | ||
*/ | ||
@Evolving | ||
public interface SupportsCatalogs { | ||
|
||
/** | ||
* List all catalogs in the metalake. | ||
* | ||
* @return The list of catalog's name identifiers. | ||
* @throws NoSuchMetalakeException If the metalake with namespace does not exist. | ||
*/ | ||
NameIdentifier[] listCatalogs() throws NoSuchMetalakeException; | ||
|
||
/** | ||
* List all catalogs with their information in the metalake. | ||
* | ||
* @return The list of catalog's information. | ||
* @throws NoSuchMetalakeException If the metalake with namespace does not exist. | ||
*/ | ||
Catalog[] listCatalogsInfo() throws NoSuchMetalakeException; | ||
|
||
/** | ||
* Load a catalog by its identifier. | ||
* | ||
* @param catalogName the identifier of the catalog. | ||
* @return The catalog. | ||
* @throws NoSuchCatalogException If the catalog does not exist. | ||
*/ | ||
Catalog loadCatalog(String catalogName) throws NoSuchCatalogException; | ||
|
||
/** | ||
* Check if a catalog exists. | ||
* | ||
* @param catalogName The identifier of the catalog. | ||
* @return True if the catalog exists, false otherwise. | ||
*/ | ||
default boolean catalogExists(String catalogName) { | ||
try { | ||
loadCatalog(catalogName); | ||
return true; | ||
} catch (NoSuchCatalogException e) { | ||
return false; | ||
} | ||
} | ||
|
||
/** | ||
* Create a catalog with specified identifier. | ||
* | ||
* <p>The parameter "provider" is a short name of the catalog, used to tell Gravitino which | ||
* catalog should be created. The short name should be the same as the {@link CatalogProvider} | ||
* interface provided. | ||
* | ||
* @param catalogName the name of the catalog. | ||
* @param type the type of the catalog. | ||
* @param provider the provider of the catalog. | ||
* @param comment the comment of the catalog. | ||
* @param properties the properties of the catalog. | ||
* @return The created catalog. | ||
* @throws NoSuchMetalakeException If the metalake does not exist. | ||
* @throws CatalogAlreadyExistsException If the catalog already exists. | ||
*/ | ||
Catalog createCatalog( | ||
String catalogName, | ||
Catalog.Type type, | ||
String provider, | ||
String comment, | ||
Map<String, String> properties) | ||
throws NoSuchMetalakeException, CatalogAlreadyExistsException; | ||
|
||
/** | ||
* Alter a catalog with specified identifier. | ||
* | ||
* @param catalogName the identifier of the catalog. | ||
* @param changes the changes to apply to the catalog. | ||
* @return The altered catalog. | ||
* @throws NoSuchCatalogException If the catalog does not exist. | ||
* @throws IllegalArgumentException If the changes cannot be applied to the catalog. | ||
*/ | ||
Catalog alterCatalog(String catalogName, CatalogChange... changes) | ||
throws NoSuchCatalogException, IllegalArgumentException; | ||
|
||
/** | ||
* Drop a catalog with specified identifier. | ||
* | ||
* @param catalogName the name of the catalog. | ||
* @return True if the catalog was dropped, false otherwise. | ||
*/ | ||
boolean dropCatalog(String catalogName); | ||
} |
83 changes: 83 additions & 0 deletions
83
api/src/main/java/com/datastrato/gravitino/rel/SupportsMetalakes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.rel; | ||
|
||
import com.datastrato.gravitino.Metalake; | ||
import com.datastrato.gravitino.MetalakeChange; | ||
import com.datastrato.gravitino.annotation.Evolving; | ||
import com.datastrato.gravitino.exceptions.MetalakeAlreadyExistsException; | ||
import com.datastrato.gravitino.exceptions.NoSuchMetalakeException; | ||
import java.util.Map; | ||
|
||
/** | ||
* Client interface for supporting metalakes. It includes methods for listing, loading, creating, | ||
* altering and dropping metalakes. | ||
*/ | ||
@Evolving | ||
public interface SupportsMetalakes { | ||
|
||
/** | ||
* List all metalakes. | ||
* | ||
* @return The list of metalakes. | ||
*/ | ||
Metalake[] listMetalakes(); | ||
|
||
/** | ||
* Load a metalake by its identifier. | ||
* | ||
* @param name the name of the metalake. | ||
* @return The metalake. | ||
* @throws NoSuchMetalakeException If the metalake does not exist. | ||
*/ | ||
Metalake loadMetalake(String name) throws NoSuchMetalakeException; | ||
|
||
/** | ||
* Check if a metalake exists. | ||
* | ||
* @param name The name of the metalake. | ||
* @return True if the metalake exists, false otherwise. | ||
*/ | ||
default boolean metalakeExists(String name) { | ||
try { | ||
loadMetalake(name); | ||
return true; | ||
} catch (NoSuchMetalakeException e) { | ||
return false; | ||
} | ||
} | ||
|
||
/** | ||
* Create a metalake with specified identifier. | ||
* | ||
* @param name The name 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(String name, String comment, Map<String, String> properties) | ||
throws MetalakeAlreadyExistsException; | ||
|
||
/** | ||
* Alter a metalake with specified identifier. | ||
* | ||
* @param name The name 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(String name, MetalakeChange... changes) | ||
throws NoSuchMetalakeException, IllegalArgumentException; | ||
|
||
/** | ||
* Drop a metalake with specified identifier. | ||
* | ||
* @param name The identifier of the metalake. | ||
* @return True if the metalake was dropped, false otherwise. | ||
*/ | ||
boolean dropMetalake(String name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.