eric-maynard commented on code in PR #1686: URL: https://github.com/apache/polaris/pull/1686#discussion_r2150996981
########## 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've refactored this to use StorageLocation and a new method there `withoutScheme`, PTAL! -- 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