diqiu50 commented on code in PR #12098:
URL: https://github.com/apache/gravitino/pull/12098#discussion_r3614118829
##########
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:
Added
--
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]