singhpk234 commented on code in PR #1686:
URL: https://github.com/apache/polaris/pull/1686#discussion_r2150878849


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java:
##########
@@ -190,6 +212,35 @@ public static String generateWhereClause(@Nonnull 
Map<String, Object> whereClaus
     return !whereConditionsString.isEmpty() ? (" WHERE " + 
whereConditionsString) : "";
   }
 
+  @VisibleForTesting
+  public static String generateVersionQuery() {
+    return "SELECT version_value FROM POLARIS_SCHEMA.VERSION";
+  }
+
+  @VisibleForTesting
+  public static <T extends PolarisEntity & LocationBasedEntity> String 
generateOverlapQuery(
+      String realmId, T entity) {
+    String location = entity.getBaseLocation();
+    String[] components = location.split("/");
+    ArrayList<String> locationClauseComponents = new ArrayList<>();
+    StringBuilder pathBuilder = new StringBuilder();
+    for (String component : components) {
+      pathBuilder.append(component).append("/");
+      locationClauseComponents.add(String.format("location = '%s'", 
pathBuilder));
+    }
+    locationClauseComponents.add(String.format("location LIKE '%s%%'", 
location));

Review Comment:
   I realized this may hamper the index being used for prefix search ? 



-- 
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: issues-unsubscr...@polaris.apache.org

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

Reply via email to