mchades commented on code in PR #12098:
URL: https://github.com/apache/gravitino/pull/12098#discussion_r3613655219


##########
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:
   This only tests the one-way conversion `"My Table" -> My Table`. Please add 
a dispatcher-level round-trip test such as `listTables() -> loadTable()`. It 
currently fails because `My Table` is normalized again to `MY TABLE`.



-- 
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]

Reply via email to