java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
@Test(timeout = 100000)
  public void testCreateDeleteTable() throws Exception {
    // Check that we can create a table.
    syncClient.createTable(tableName, basicSchema, getBasicCreateTableOptions());
    assertFalse(syncClient.getTablesList().getTablesList().isEmpty());
    assertTrue(syncClient.getTablesList().getTablesList().contains(tableName));

    // Check that we can delete it.
    syncClient.deleteTable(tableName);
    assertFalse(syncClient.getTablesList().getTablesList().contains(tableName));

    // Check that we can re-recreate it, with a different schema.
    List<ColumnSchema> columns = new ArrayList<>(basicSchema.getColumns());
    columns.add(new ColumnSchema.ColumnSchemaBuilder("one more", Type.STRING).build());
    Schema newSchema = new Schema(columns);
    syncClient.createTable(tableName, newSchema, getBasicCreateTableOptions());

    // Check that we can open a table and see that it has the new schema.
    KuduTable table = syncClient.openTable(tableName);
    assertEquals(newSchema.getColumnCount(), table.getSchema().getColumnCount());
    assertTrue(table.getPartitionSchema().isSimpleRangePartitioning());

    // Check that the block size parameter we specified in the schema is respected.
    assertEquals(4096, newSchema.getColumn("column3_s").getDesiredBlockSize());
    assertEquals(ColumnSchema.Encoding.DICT_ENCODING,
                 newSchema.getColumn("column3_s").getEncoding());
    assertEquals(ColumnSchema.CompressionAlgorithm.LZ4,
                 newSchema.getColumn("column3_s").getCompressionAlgorithm());
  }
/**
   * Test creating and deleting a table through a KuduClient.
   */
Test creating and deleting a table through a KuduClient.
Test creating and deleting a table through a KuduClient .
@Test(timeout = 100000)
  public void testCreateDeleteTable() throws Exception {
    syncClient.createTable(tableName, basicSchema, getBasicCreateTableOptions());
    assertFalse(syncClient.getTablesList().getTablesList().isEmpty());
    assertTrue(syncClient.getTablesList().getTablesList().contains(tableName));
    syncClient.deleteTable(tableName);
    assertFalse(syncClient.getTablesList().getTablesList().contains(tableName));
    List<ColumnSchema> columns = new ArrayList<>(basicSchema.getColumns());
    columns.add(new ColumnSchema.ColumnSchemaBuilder("one more", Type.STRING).build());
    Schema newSchema = new Schema(columns);
    syncClient.createTable(tableName, newSchema, getBasicCreateTableOptions());
    KuduTable table = syncClient.openTable(tableName);
    assertEquals(newSchema.getColumnCount(), table.getSchema().getColumnCount());
    assertTrue(table.getPartitionSchema().isSimpleRangePartitioning());
    assertEquals(4096, newSchema.getColumn("column3_s").getDesiredBlockSize());
    assertEquals(ColumnSchema.Encoding.DICT_ENCODING,
                 newSchema.getColumn("column3_s").getEncoding());
    assertEquals(ColumnSchema.CompressionAlgorithm.LZ4,
                 newSchema.getColumn("column3_s").getCompressionAlgorithm());
  }
@ Test ( timeout = 100000 ) public void testCreateDeleteTable ( ) throws Exception { syncClient . createTable ( tableName , basicSchema , getBasicCreateTableOptions ( ) ) ; assertFalse ( syncClient . getTablesList ( ) . getTablesList ( ) . isEmpty ( ) ) ; assertTrue ( syncClient . getTablesList ( ) . getTablesList ( ) . contains ( tableName ) ) ; syncClient . deleteTable ( tableName ) ; assertFalse ( syncClient . getTablesList ( ) . getTablesList ( ) . contains ( tableName ) ) ; List < ColumnSchema > columns = new ArrayList < > ( basicSchema . getColumns ( ) ) ; columns . add ( new ColumnSchema . ColumnSchemaBuilder ( "one more" , Type . STRING ) . build ( ) ) ; Schema newSchema = new Schema ( columns ) ; syncClient . createTable ( tableName , newSchema , getBasicCreateTableOptions ( ) ) ; KuduTable table = syncClient . openTable ( tableName ) ; assertEquals ( newSchema . getColumnCount ( ) , table . getSchema ( ) . getColumnCount ( ) ) ; assertTrue ( table . getPartitionSchema ( ) . isSimpleRangePartitioning ( ) ) ; assertEquals ( 4096 , newSchema . getColumn ( "column3_s" ) . getDesiredBlockSize ( ) ) ; assertEquals ( ColumnSchema . Encoding . DICT_ENCODING , newSchema . getColumn ( "column3_s" ) . getEncoding ( ) ) ; assertEquals ( ColumnSchema . CompressionAlgorithm . LZ4 , newSchema . getColumn ( "column3_s" ) . getCompressionAlgorithm ( ) ) ; }
Test creating and deleting a table through a KuduClient.
Test creating and deleting a table through a KuduClient .
// Check that we can create a table. // Check that we can delete it. // Check that we can re-recreate it, with a different schema. // Check that we can open a table and see that it has the new schema. // Check that the block size parameter we specified in the schema is respected.