pithecuse527 commented on code in PR #14381:
URL: https://github.com/apache/gravitino/pull/14381#discussion_r4414883784


##########
core/src/main/java/org/apache/gravitino/cache/CaffeineEntityCache.java:
##########
@@ -359,6 +363,36 @@ private void invalidateDescendants(String keyPrefix) {
     }
   }
 
+  /**
+   * Returns the prefix-index key of a cache key: the escaped identifier text, 
{@code ":"}, and the
+   * entity type.
+   */
+  private static String indexKey(EntityCacheKey key) {
+    return indexText(key.identifier()) + ":" + key.entityType();
+  }
+
+  /**
+   * Joins the levels of an identifier into prefix-index text.
+   *
+   * <p>{@link NameIdentifier#toString()} is not one-to-one when a level 
contains {@code "."}: table
+   * {@code a.b} in schema {@code sch} and table {@code b} in schema {@code 
sch.a} both render as
+   * {@code sch.a.b}. Escaping {@code "."} and the escape character inside 
each level makes the text
+   * unique, while every real level boundary stays a bare {@code "."}, so both 
prefix scans in
+   * {@link #invalidateHierarchy(EntityCacheKey)} still match exactly the 
descendants. The schema
+   * separator can be neither {@code "."} nor the escape character, so it is 
kept as is.
+   */
+  private static String indexText(NameIdentifier ident) {

Review Comment:
   it seems copilot raised this concern because i did not include a Javadoc 
pointing to `Configs.SCHEMA_SEPARATOR`
   
   i've added the javadoc pointer.



-- 
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]

Reply via email to