You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "justinmclean (via GitHub)" <gi...@apache.org> on 2025/08/20 05:17:03 UTC

[I] [Improvement] Added a missing validation in TableDTO.Builder.build() [gravitino]

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

   ### What would you like to be improved?
   
   Added missing validation to TableDTO.Builder.build() to make sure the table has a non-null, non-empty column list before construction, as indicated in the comment.
   
   Here are some tests that should help:
   ```
    @Test
     public void testBuildWithoutColumns() {
       AuditDTO audit = AuditDTO.builder().withCreator("creator").withCreateTime(Instant.now()).build();
       TableDTO.Builder builder = TableDTO.builder().withName("t1").withAudit(audit);
       assertThrows(IllegalArgumentException.class, builder::build);
     }
   
     @Test
     public void testBuildWithEmptyColumns() {
       AuditDTO audit = AuditDTO.builder().withCreator("creator").withCreateTime(Instant.now()).build();
       TableDTO.Builder builder =
           TableDTO.builder().withName("t1").withAudit(audit).withColumns(new ColumnDTO[0]);
       assertThrows(IllegalArgumentException.class, builder::build);
     }
   
     @Test
     public void testBuildWithColumns() {
       AuditDTO audit = AuditDTO.builder().withCreator("creator").withCreateTime(Instant.now()).build();
       ColumnDTO column =
           ColumnDTO.builder().withName("c1").withDataType(Types.IntegerType.get()).build();
       assertDoesNotThrow(
           () ->
               TableDTO.builder()
                   .withName("t1")
                   .withAudit(audit)
                   .withColumns(new ColumnDTO[] {column})
                   .build());
     }
   ```
   
   ### How should we improve?
   
   Add a checkArgument precondition.


-- 
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: commits-unsubscribe@gravitino.apache.org.apache.org

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


Re: [I] [Improvement] Added a missing validation in TableDTO.Builder.build() [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean closed issue #8196: [Improvement] Added a missing validation in TableDTO.Builder.build()
URL: https://github.com/apache/gravitino/issues/8196


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [I] [Improvement] Added a missing validation in TableDTO.Builder.build() [gravitino]

Posted by "pandeysambhi (via GitHub)" <gi...@apache.org>.
pandeysambhi commented on issue #8196:
URL: https://github.com/apache/gravitino/issues/8196#issuecomment-3209020209

   @justinmclean I can pick this up
   


-- 
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: commits-unsubscribe@gravitino.apache.org

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