Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/357#discussion_r24139933
  
    --- Diff: 
tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java 
---
    @@ -45,54 +45,72 @@
     import org.apache.tajo.util.KeyValueSet;
     import org.apache.tajo.worker.TajoWorker;
     import org.junit.Test;
    +import org.junit.runner.RunWith;
    +import org.junit.runners.Parameterized;
     
     import java.io.IOException;
     import java.sql.ResultSet;
    -import java.util.ArrayList;
    -import java.util.List;
    -import java.util.Map;
    -import java.util.Random;
    +import java.util.*;
     
     import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
     import static 
org.apache.tajo.plan.serder.PlanProto.ShuffleType.SCATTERED_HASH_SHUFFLE;
     import static org.junit.Assert.*;
     
    +@RunWith(Parameterized.class)
     public class TestTablePartitions extends QueryTestCaseBase {
     
    +  private NodeType nodeType;
     
    -  public TestTablePartitions() throws IOException {
    +  public TestTablePartitions(NodeType nodeType) throws IOException {
         super(TajoConstants.DEFAULT_DATABASE_NAME);
    +    this.nodeType = nodeType;
    +  }
    +
    +  @Parameterized.Parameters
    +  public static Collection<Object[]> generateParameters() {
    +    return Arrays.asList(new Object[][] {
    +      //type
    +      {NodeType.INSERT},
    +      {NodeType.CREATE_TABLE},
    +    });
       }
     
       @Test
       public final void testCreateColumnPartitionedTable() throws Exception {
    +    ResultSet res = null;
         String tableName = 
CatalogUtil.normalizeIdentifier("testCreateColumnPartitionedTable");
    -    ResultSet res = executeString(
    +
    +    if (nodeType == NodeType.INSERT) {
    +      res = executeString(
             "create table " + tableName + " (col1 int4, col2 int4) partition 
by column(key float8) ");
    -    res.close();
    +      res.close();
     
    -    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    -    assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getSchema().size());
    -    assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, 
tableName).getLogicalSchema().size());
    +      assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
    --- End diff --
    
    The assert statements for CREATE or INSERT are duplicated. This kind of 
assert statements in other unit test methods are also duplicated. You need to 
keep only one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to