mingnuj commented on issue #11990:
URL: https://github.com/apache/iceberg/issues/11990#issuecomment-2630077016

   I am attaching the solution I personally implemented based on the provided 
guidance, as someone else might encounter the same issue.
   
   I wanted the namespace to allow dots not only in tests but also in actual 
operation. Based on the test added in #11991 , I introduced a new flag, 
jdbc.supports-names-with-dot.
   
   
https://github.com/apache/iceberg/blob/472ec6cbdcaa24773ef5c64c9444ae933805381d/core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java#L43-L44
   
   ```java
     static final String INIT_CATALOG_TABLES_PROPERTY =
         JdbcCatalog.PROPERTY_PREFIX + "init-catalog-tables";
   +  // property to control if namespace can contain dots
   +  static final String SUPPORTS_NAMES_WITH_DOT = JdbcCatalog.PROPERTY_PREFIX 
+ "supports-names-with-dot";
   ```
   
   The flag, withDot field is defined in JdbcCatalog and is initialized in the 
initialize function, where the flag is set and stored as a boolean value.
   
   at here, 
   
   
https://github.com/apache/iceberg/blob/472ec6cbdcaa24773ef5c64c9444ae933805381d/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L109
   
   add these lines
   
   ```java
       boolean withDot = PropertyUtil.propertyAsBoolean(properties, 
JdbcUtil.SUPPORTS_NAMES_WITH_DOT, false);
       this.withDot = withDot;
   ```
   
   Following @nastra's guidance, modified the `stringToNamespace` function. I 
sincerely appreciate it.
   
   
https://github.com/apache/iceberg/blob/472ec6cbdcaa24773ef5c64c9444ae933805381d/core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java#L501-L508
   
   like this
   
   ```java
     static Namespace stringToNamespace(String namespace, boolean withDot) {
       Preconditions.checkArgument(namespace != null, "Invalid namespace %s", 
namespace);
       if (namespace.isEmpty()) {
         return Namespace.empty();
       }
       if (withDot) {
         return Namespace.of(namespace);
       } else {
         return Namespace.of(Iterables.toArray(SPLITTER_DOT.split(namespace), 
String.class));
       }
     }
   ```
   
   The rest was simply adjusting the function parameters accordingly.
   After modifying the relevant parts, I built and ran the project separately, 
and it worked as expected.
   
   Thank you all for your help.
   I will now close this issue.


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to