yuqi1129 commented on code in PR #5757:
URL: https://github.com/apache/gravitino/pull/5757#discussion_r1871377162
##########
api/src/main/java/org/apache/gravitino/SupportsCatalogs.java:
##########
@@ -78,12 +78,14 @@ default boolean catalogExists(String catalogName) {
* Create a catalog with specified catalog name, type, provider, comment,
and properties.
*
* <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.
+ * catalog should be created. The short name:
+ *
+ * <p>1) should be the same as the {@link CatalogProvider} interface
provided. 2) can be "null" if
+ * the created catalog is a built-in catalog, like model catalog.
Review Comment:
And, so the provider of all the built-in catalog is null?
##########
common/src/main/java/org/apache/gravitino/dto/requests/CatalogCreateRequest.java:
##########
@@ -79,6 +81,17 @@ public CatalogCreateRequest(
this.properties = properties;
}
+ /**
+ * Sets the provider of the catalog.
+ *
+ * @param provider The provider of the catalog.
+ */
+ @JsonSetter(value = "provider")
+ public void setProvider(String provider) {
+ this.provider =
+ StringUtils.isNotBlank(provider) ? provider :
CatalogProvider.builtinShortName(type);
Review Comment:
I'm afraid that we should not mix up the concept provider and type, in your
code, for the built-in catalog, the value of type is the same as that of the
provider.
Another point, in the code above, the provider of the model catalog is
`null`, why do we set it to `builtinShortName ` NOT null here.
##########
api/src/main/java/org/apache/gravitino/SupportsCatalogs.java:
##########
@@ -78,12 +78,14 @@ default boolean catalogExists(String catalogName) {
* Create a catalog with specified catalog name, type, provider, comment,
and properties.
*
* <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.
+ * catalog should be created. The short name:
+ *
+ * <p>1) should be the same as the {@link CatalogProvider} interface
provided. 2) can be "null" if
+ * the created catalog is a built-in catalog, like model catalog.
Review Comment:
I'm very puzzle about the concept of `built-in` catalog, can you explain it
more clearly.
##########
clients/client-python/gravitino/dto/requests/catalog_create_request.py:
##########
@@ -60,5 +60,3 @@ def validate(self):
raise ValueError('"name" field is required and cannot be empty')
if not self._type:
raise ValueError('"catalog_type" field is required and cannot be
empty')
- if not self._provider:
Review Comment:
This seems to break the interface definition, so please add more examples of
when the provider will be null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]