jerryshao commented on code in PR #6751:
URL: https://github.com/apache/gravitino/pull/6751#discussion_r2020390559


##########
catalogs/catalog-hive/src/test/java/org/apache/gravitino/catalog/hive/TestHiveCatalog.java:
##########
@@ -125,6 +125,8 @@ void testCatalogProperty() {
         throwable
             .getMessage()
             .contains(
-                String.format("Properties are required and must be set: [%s]", 
METASTORE_URIS)));
+                String.format(
+                    "Properties or properties with a fixed prefix are required 
and must be set: [%s]",

Review Comment:
   "Properties or property prefixes..."



##########
core/src/main/java/org/apache/gravitino/connector/PropertiesMetadata.java:
##########
@@ -102,10 +149,34 @@ default Object getOrDefault(Map<String, String> 
properties, String propertyName)
    * @return the default value object of the property.
    */
   default Object getDefaultValue(String propertyName) {
+    PropertyEntry<?> propertyEntry = getPropertyEntry(propertyName);
+
+    return propertyEntry.getDefaultValue();
+  }
+
+  /**
+   * Get the property entry of the property.
+   *
+   * @param propertyName The name of the property.
+   * @return the property entry object of the property.
+   * @throws IllegalArgumentException if the property is not defined.
+   */
+  default PropertyEntry<?> getPropertyEntry(String propertyName) throws 
IllegalArgumentException {
     if (!containsProperty(propertyName)) {
       throw new IllegalArgumentException("Property is not defined: " + 
propertyName);
     }
 
-    return propertyEntries().get(propertyName).getDefaultValue();
+    return propertyEntries().get(propertyName) != null
+        ? propertyEntries().get(propertyName)
+        : propertyEntries().entrySet().stream()
+            .filter(e -> e.getValue().isPrefix() && 
propertyName.startsWith(e.getKey()))
+            // get the longest prefix property
+            
.max(Map.Entry.comparingByKey(Comparator.comparingInt(String::length)))

Review Comment:
   What's the meaning here, can you explain more?



-- 
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: commits-unsubscr...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to