ocean-zhc commented on issue #9396:
URL: https://github.com/apache/seatunnel/issues/9396#issuecomment-2943398826

   ```java
   public static TablePath of(String fullName, boolean schemaFirst) {
           String[] paths = fullName.split("\\.");
   
           if (paths.length == 1) {
               return of(null, paths[0]);
           }
           if (paths.length == 2) {
               if (schemaFirst) {
                   return of(null, paths[0], paths[1]);
               }
               return of(paths[0], null, paths[1]);
           }
           if (paths.length == 3) {
               return of(paths[0], paths[1], paths[2]);
           }
           throw new IllegalArgumentException(
                   String.format("Cannot get split '%s' to get databaseName and 
tableName", fullName));
       }
   ```
   
   Modify the following: 
   (Changed to split by the last two dots only, with the previous ones as 
databaseName. this is compatible with database names with dots in them.)
   
   ```java
   public static TablePath of(String fullName, boolean schemaFirst) {
       int lastDot = fullName.lastIndexOf('.');
       if (lastDot < 0) {
           return of(null, fullName);
       }
       int secondLastDot = fullName.lastIndexOf('.', lastDot - 1);
       if (secondLastDot < 0) {
           if (schemaFirst) {
               return of(null, fullName.substring(0, lastDot), 
fullName.substring(lastDot + 1));
           }
           return of(fullName.substring(0, lastDot), null, 
fullName.substring(lastDot + 1));
       }
       String database = fullName.substring(0, secondLastDot);
       String schema = fullName.substring(secondLastDot + 1, lastDot);
       String table = fullName.substring(lastDot + 1);
       if (StringUtils.isEmpty(table)) {
           throw new IllegalArgumentException(
               String.format("Cannot get split '%s' to get databaseName and 
tableName", fullName));
       }
       return of(database, schema, 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