final AkibanInformationSchema origAIS = schemaManager.getAis(session);
final AkibanInformationSchema newAIS = schemaManager.getOnlineAIS(session);
final Schema origSchema = SchemaCache.globalSchema(origAIS);
final StoreAdapter origAdapter = store.createAdapter(session, origSchema);
final QueryContext origContext = new DelegatingContext(origAdapter, context);
final QueryBindings origBindings = origContext.createBindings();
final TransformCache transformCache = getTransformCache(session, null);
Set<Table> origRoots = findOldRoots(changeSets, origAIS, newAIS);
for(Table root : origRoots) {
Operator plan = API.groupScan_Default(root.getGroup());
runPlan(session, contextIfNull(context, origAdapter), schemaManager, txnService, plan, new RowHandler() {
@Override
public void handleRow(Row oldRow) {
TableTransform transform = transformCache.get(oldRow.rowType().typeId());
Row newRow = transformRow(origContext, origBindings, transform, oldRow);
origAdapter.writeRow(newRow, transform.tableIndexes, transform.groupIndexes);
}
});
}
}