Tables implements Iterable<Table> { public void createTableWithLifeCycle(String projectName, String tableName, TableSchema schema, String comment, boolean ifNotExists, Long lifeCycle) throws OdpsException { create(projectName, tableName, schema, comment, ifNotExists, lifeCycle, null, null); } Tables(Odps odps); Table get(String tableName); Table get(String projectName, String tableName); boolean exists(String tableName); boolean exists(String projectName, String tableName); @Override Iterator<Table> iterator(); Iterator<Table> iterator(final String projectName); Iterator<Table> iterator(final TableFilter filter); Iterator<Table> iterator(final String projectName, final TableFilter filter); Iterator<Table> iterator(final String projectName,
                                  final TableFilter filter,
                                  boolean extended); Iterable<Table> iterable(); Iterable<Table> iterable(final String projectName); Iterable<Table> iterable(final TableFilter filter); Iterable<Table> iterable(final String projectName, final TableFilter filter); Iterable<Table> iterable(final String projectName,
                                  final TableFilter filter,
                                  boolean extended); void create(String tableName, TableSchema schema); void create(String tableName, TableSchema schema, boolean ifNotExists); void create(String projectName, String tableName, TableSchema schema, boolean ifNotExists,
                     Long shardNum, Long hubLifecycle); void create(String projectName, String tableName, TableSchema schema); void create(String projectName, String tableName, TableSchema schema, boolean ifNotExists); void create(String projectName, String tableName, TableSchema schema,
                     String comment, boolean ifNotExists, Long shardNum, Long hubLifecycle); void create(String projectName, String tableName, TableSchema schema, String comment,
                     boolean ifNotExists); void createTableWithLifeCycle(String projectName, String tableName, TableSchema schema,
                                       String comment, boolean ifNotExists, Long lifeCycle); void create(String projectName, String tableName, TableSchema schema,
                     String comment, boolean ifNotExists, Long lifeCycle,
                     Map<String, String> hints, Map<String, String> aliases); void createExternal(String projectName, String tableName, TableSchema schema,
                             String location, String storedBy, List<String> usingJars, Map<String, String> serdeProperties,
                             String comment, boolean ifNotExists, Long lifeCycle,
                             Map<String, String> hints, Map<String, String> aliases); void delete(String tableName); void delete(String tableName, boolean ifExists); void delete(String projectName, String tableName); void delete(String projectName, String tableName, boolean ifExists); List<Table> loadTables(final Collection<String> tableNames); List<Table> loadTables(final String projectName, final Collection<String> tableNames); List<Table> reloadTables(final Collection<Table> tables); List<Table> reloadTables(final Iterator<Table> tables);  }
@Test public void testCreateTableWithLifeCycle() throws OdpsException { UUID id = UUID.randomUUID(); String tableName = "testCreateTableWithLifeCycle" + id.toString().replace("-", ""); TableSchema schema = new TableSchema(); schema.addColumn(new Column("c1", OdpsType.BIGINT)); schema.addColumn(new Column("_c2", OdpsType.STRING, "_comment here")); schema.addPartitionColumn(new Column("p1", OdpsType.STRING)); schema.addPartitionColumn(new Column("_p2", OdpsType.STRING, "_comment here")); odps.tables() .createTableWithLifeCycle(odps.getDefaultProject(), tableName, schema, null, false, 10L); assertEquals(odps.tables().get(tableName).getLife(), 10L); deleteTable(tableName); }