dimas-b commented on code in PR #1686:
URL: https://github.com/apache/polaris/pull/1686#discussion_r2124418380
##########
extension/persistence/relational-jdbc/src/test/java/org/apache/polaris/extension/persistence/relational/jdbc/QueryGeneratorTest.java:
##########
@@ -222,4 +222,29 @@ void testGenerateWhereClause_emptyMap() {
Map<String, Object> whereClause = Collections.emptyMap();
assertEquals("", QueryGenerator.generateWhereClause(whereClause));
}
+
+ @Test
+ void testGenerateOverlapQuery() {
+ String realmId = "realmId";
+ int parentId = "polaris".hashCode();
+
+ assertEquals(
+ "SELECT entity_version, to_purge_timestamp, internal_properties, "
+ + "catalog_id, purge_timestamp, sub_type_code, create_timestamp,
last_update_timestamp, "
+ + "parent_id, name, location, id, drop_timestamp, properties,
grant_records_version, "
+ + "type_code FROM POLARIS_SCHEMA.ENTITIES WHERE realm_id =
'realmId' AND parent_id = "
+ + "-398224152 AND (1 = 2 OR location = '/' OR location = '/tmp/'
OR location = '/tmp/location/' "
+ + "OR location LIKE '/tmp/location/%')",
+ QueryGenerator.generateOverlapQuery(realmId, parentId,
"/tmp/location/"));
+
+ assertEquals(
+ "SELECT entity_version, to_purge_timestamp, internal_properties,
catalog_id, "
+ + "purge_timestamp, sub_type_code, create_timestamp,
last_update_timestamp, parent_id, "
+ + "name, location, id, drop_timestamp, properties,
grant_records_version, type_code "
+ + "FROM POLARIS_SCHEMA.ENTITIES WHERE realm_id = 'realmId' AND
parent_id = -398224152 "
+ + "AND (1 = 2 OR location = 's3:/' OR location = 's3://' OR
location = 's3://bucket/' OR "
Review Comment:
`s3:/` is not a valid storage URI by any means. It is specifically not a
valid prefix for a storage location. What is the rationale trying to find it in
the location properties of other entries?
Granted, Polaris should not allow storing `s3:/` as a location property.
However, if that happens for any reason, the current impl. will block any other
S3 catalog creation. In effect, the current optimization implementation has a
tendency to exacerbate errors (as opposed to dampening them, or at least being
neutral).
--
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]