This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 9043b3537e [#6544] improvement(catalog): support hyphen in catalog 
name (#7050)
9043b3537e is described below

commit 9043b3537e6dfcb30c5789e07dd2f3d93d7239be
Author: mchades <[email protected]>
AuthorDate: Wed Apr 23 17:19:40 2025 +0800

    [#6544] improvement(catalog): support hyphen in catalog name (#7050)
    
    ### What changes were proposed in this pull request?
    
    support hyphen in catalog name
    
    ### Why are the changes needed?
    
    Fix: #6544
    
    ### Does this PR introduce _any_ user-facing change?
    
    yes, user now can use hyphen in catalog name
    
    ### How was this patch tested?
    
    tests added
---
 .../gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java     | 3 +++
 .../java/org/apache/gravitino/catalog/CatalogNormalizeDispatcher.java  | 2 +-
 .../org/apache/gravitino/catalog/TestCatalogNormalizeDispatcher.java   | 1 -
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
 
b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
index 2cb6bd327b..5dbba66593 100644
--- 
a/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
+++ 
b/catalogs/catalog-hadoop/src/test/java/org/apache/gravitino/catalog/hadoop/integration/test/HadoopCatalogIT.java
@@ -484,6 +484,9 @@ public class HadoopCatalogIT extends BaseIT {
 
   @Test
   void testNameSpec() {
+    Assertions.assertDoesNotThrow(
+        () -> metalake.createCatalog("my-catalog", Catalog.Type.FILESET, 
provider, null, null));
+
     String illegalName = "ok/test";
 
     // test illegal catalog name
diff --git 
a/core/src/main/java/org/apache/gravitino/catalog/CatalogNormalizeDispatcher.java
 
b/core/src/main/java/org/apache/gravitino/catalog/CatalogNormalizeDispatcher.java
index 01bfc8f9e2..56c75a6318 100644
--- 
a/core/src/main/java/org/apache/gravitino/catalog/CatalogNormalizeDispatcher.java
+++ 
b/core/src/main/java/org/apache/gravitino/catalog/CatalogNormalizeDispatcher.java
@@ -48,7 +48,7 @@ public class CatalogNormalizeDispatcher implements 
CatalogDispatcher {
    *
    * <p>$ - End of the string
    */
-  private static final String CATALOG_NAME_PATTERN = "^\\w[\\w]{0,63}$";
+  private static final String CATALOG_NAME_PATTERN = "^\\w[\\w-]{0,63}$";
 
   private final CatalogDispatcher dispatcher;
 
diff --git 
a/core/src/test/java/org/apache/gravitino/catalog/TestCatalogNormalizeDispatcher.java
 
b/core/src/test/java/org/apache/gravitino/catalog/TestCatalogNormalizeDispatcher.java
index 7904f7494f..9babbe7ce6 100644
--- 
a/core/src/test/java/org/apache/gravitino/catalog/TestCatalogNormalizeDispatcher.java
+++ 
b/core/src/test/java/org/apache/gravitino/catalog/TestCatalogNormalizeDispatcher.java
@@ -126,7 +126,6 @@ public class TestCatalogNormalizeDispatcher {
     Assertions.assertEquals("The catalog name '*' is reserved.", 
exception.getMessage());
 
     String[] illegalNames = {
-      "catalog-xxx",
       "catalog/xxx",
       "catalog.xxx",
       "catalog xxx",

Reply via email to