yuqi1129 commented on code in PR #7317:
URL: https://github.com/apache/gravitino/pull/7317#discussion_r2145022731
##########
trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/HasPropertyMeta.java:
##########
@@ -26,21 +26,38 @@
/** Interface for adding property metadata to the catalogs */
public interface HasPropertyMeta {
- /** Property metadata for schema */
+ /**
+ * Gets the property metadata for schemas.
Review Comment:
Get the property metadata for a specific schema.
##########
trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/metadata/GravitinoCatalog.java:
##########
@@ -113,28 +163,63 @@ public String getRequiredProperty(String name) throws
Exception {
return value;
}
+ /**
+ * Retrieves the properties of the catalog.
+ *
+ * @return the properties of the catalog
+ */
@JsonProperty
public Map<String, String> getProperties() {
return properties;
}
+ /**
+ * Retrieves the last modified time of the catalog.
+ *
+ * @return the last modified time of the catalog
+ */
@JsonProperty
public long getLastModifiedTime() {
return lastModifiedTime;
}
+ /**
+ * Converts a Gravitino catalog to a JSON string.
+ *
+ * @param catalog the Gravitino catalog
+ * @return the JSON string
+ * @throws JsonProcessingException if the catalog cannot be converted to a
JSON string
+ */
public static String toJson(GravitinoCatalog catalog) throws
JsonProcessingException {
return objectMapper.writeValueAsString(catalog);
}
+ /**
+ * Converts a JSON string to a Gravitino catalog.
+ *
+ * @param jsonString the JSON string
+ * @return the Gravitino catalog
+ * @throws JsonProcessingException if the JSON string cannot be converted to
a Gravitino catalog
+ */
public static GravitinoCatalog fromJson(String jsonString) throws
JsonProcessingException {
return objectMapper.readValue(jsonString, GravitinoCatalog.class);
}
+ /**
+ * Retrieves the region of the catalog.
+ *
+ * @return the region of the catalog
+ */
public String getRegion() {
return properties.getOrDefault(CLOUD_REGION_CODE, "");
}
+ /**
+ * Checks if the catalog is in the same region as the specified region.
+ *
+ * @param region the region to check
+ * @return true if the catalog is in the same region as the specified
region, false otherwise
+ */
Review Comment:
This may not be related to this PR
```java
public boolean isSameRegion(String region) {
// When the Gravitino connector has not configured the cloud.region-code,
// or the catalog has not configured the cloud.region-code,
// or the catalog cluster name is equal to the connector-configured
region code,
// the catalog is belong to the region
return StringUtils.isEmpty(region)
|| StringUtils.isEmpty(getRegion())
|| region.equals(getRegion());
}
```
Judging from the code above, it seems that as long as the parameter `region`
is not empty, the result is always true. @diqiu50 Please help to confirm this
point.
--
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]