diqiu50 commented on code in PR #12098:
URL: https://github.com/apache/gravitino/pull/12098#discussion_r3614146586
##########
core/src/test/java/org/apache/gravitino/catalog/TestCapabilityHelpers.java:
##########
@@ -92,4 +127,19 @@ void
testApplyCaseSensitiveOnNameAllowsNullNameToPassThrough() {
Capability.Scope.PARTITION, null, Capability.DEFAULT);
Assertions.assertNull(normalized);
}
+
+ @Test
+ void testApplyCapabilitiesValidatesNameBeforeNormalizing() {
+ // A quoted name with an embedded space is valid as supplied, but its
normalized (unquoted)
+ // form no longer matches the plain-word pattern. specificationOnName must
be checked against
+ // the original name, not the already-normalized one, or this would be
wrongly rejected.
+ NameIdentifier quotedIdent =
+ NameIdentifier.of(Namespace.of("metalake", "catalog", "schema"), "\"My
Table\"");
+
+ NameIdentifier result =
+ CapabilityHelpers.applyCapabilities(
+ quotedIdent, Capability.Scope.TABLE, QUOTE_AWARE_CAPABILITY);
+
+ Assertions.assertEquals("My Table", result.name());
Review Comment:
In this scenario, the double quotes " are just a marker telling Oracle how
to fold the name — they're not part of the physical name itself. listTables()
returns the physical name without the quotes (e.g. My Table). If you want to
loadTable() that same case-sensitive table again, you need to add the quotes
back ("My Table"), the same way you'd write it in SQL.
I added a test (testCreateTableListTablesLoadTableRoundTrip) covering the
full createTable("\"My Table\"") → listTables() → loadTable("\"My Table\"")
round trip, confirming the physical name is preserved correctly throughout when
used this way.
--
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]