@Test public void alter() throws Exception { SourceKey tableKey = new SourceKey(meta.getTableName()); com.fr.swift.db.Table table = SwiftDatabase.getInstance().createTable(tableKey, meta); Importer inserter = getInserter(table, new HistoryLineSourceAlloter(tableKey, new LineAllotRule(10))); inserter.importResultSet(new LimitedResultSet(new SupplierResultSet(meta, new Supplier<Row>() { @Override public Row get() { A a = new A(); return new ListBasedRow(Collections.<Object>singletonList(a.i)); } }), 25)); new AddColumnAction(new MetaDataColumnEntity("d", Types.DOUBLE)).alter(table); table = SwiftDatabase.getInstance().getTable(tableKey); checkMeta(table); checkSeg(table); }
@Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); @Override void alter(Table table); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); @Override void alter(Table table);  }