java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduClient.java
@Test(timeout = 100000)
  public void testCreateTableTooManyColumns() throws Exception {
    List<ColumnSchema> cols = new ArrayList<>();
    cols.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.STRING)
             .key(true)
             .build());
    for (int i = 0; i < 1000; i++) {
      // not null with default
      cols.add(new ColumnSchema.ColumnSchemaBuilder("c" + i, Type.STRING)
               .build());
    }
    Schema schema = new Schema(cols);
    try {
      syncClient.createTable(tableName, schema, getBasicCreateTableOptions());
      fail();
    } catch (NonRecoverableException nre) {
      assertThat(nre.toString(), containsString(
          "number of columns 1001 is greater than the permitted maximum"));
    }
  }
/**
   * Test creating a table with various invalid schema cases.
   */
Test creating a table with various invalid schema cases.
Test creating a table with various invalid schema cases .
@Test(timeout = 100000)
  public void testCreateTableTooManyColumns() throws Exception {
    List<ColumnSchema> cols = new ArrayList<>();
    cols.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.STRING)
             .key(true)
             .build());
    for (int i = 0; i < 1000; i++) {
      cols.add(new ColumnSchema.ColumnSchemaBuilder("c" + i, Type.STRING)
               .build());
    }
    Schema schema = new Schema(cols);
    try {
      syncClient.createTable(tableName, schema, getBasicCreateTableOptions());
      fail();
    } catch (NonRecoverableException nre) {
      assertThat(nre.toString(), containsString(
          "number of columns 1001 is greater than the permitted maximum"));
    }
  }
@ Test ( timeout = 100000 ) public void testCreateTableTooManyColumns ( ) throws Exception { List < ColumnSchema > cols = new ArrayList < > ( ) ; cols . add ( new ColumnSchema . ColumnSchemaBuilder ( "key" , Type . STRING ) . key ( true ) . build ( ) ) ; for ( int i = 0 ; i < 1000 ; i ++ ) { cols . add ( new ColumnSchema . ColumnSchemaBuilder ( "c" + i , Type . STRING ) . build ( ) ) ; } Schema schema = new Schema ( cols ) ; try { syncClient . createTable ( tableName , schema , getBasicCreateTableOptions ( ) ) ; fail ( ) ; } catch ( NonRecoverableException nre ) { assertThat ( nre . toString ( ) , containsString ( "number of columns 1001 is greater than the permitted maximum" ) ) ; } }
Test creating a table with various invalid schema cases.
Test creating a table with various invalid schema cases .
// not null with default