justinmclean opened a new issue, #9136:
URL: https://github.com/apache/gravitino/issues/9136

   ### What would you like to be improved?
   
   
   The bucket number should be trimmed up front to stop a potential 
NumberFormatException.
   
   Here's a unit test to help
   ```
   
     @Test
     public void testExtractBucketNumWithWhitespace() {
       String createTableSqlWithWhitespace =
           "CREATE TABLE `testTable` (\n`col1` int NOT NULL\n) ENGINE=OLAP\n 
DISTRIBUTED BY HASH(`col1`) BUCKETS  16 ";
       Distribution distribution = 
DorisUtils.extractDistributionInfoFromSql(createTableSqlWithWhitespace);
       assertEquals(16, distribution.number());
   
       String createTableSqlWithAutoWhitespace =
           "CREATE TABLE `testTable` (\n`col1` int NOT NULL\n) ENGINE=OLAP\n 
DISTRIBUTED BY HASH(`col1`) BUCKETS  AUTO ";
       Distribution distributionAuto =
           
DorisUtils.extractDistributionInfoFromSql(createTableSqlWithAutoWhitespace);
       assertEquals(-1, distributionAuto.number());
   
       String createTableSqlWithAutoLeadingWhitespace =
           "CREATE TABLE `testTable` (\n`col1` int NOT NULL\n) ENGINE=OLAP\n 
DISTRIBUTED BY HASH(`col1`) BUCKETS  AUTO";
       Distribution distributionAutoLeading =
           
DorisUtils.extractDistributionInfoFromSql(createTableSqlWithAutoLeadingWhitespace);
       assertEquals(-1, distributionAutoLeading.number());
     }
   ```
   
   ### How should we improve?
   
   _No response_


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