context.fail(new SchemaChangeException("Incoming batches for merging receiver have diffferent schemas!"));
return IterOutcome.STOP;
}
// create the outgoing schema and vector container, and allocate the initial batch
SchemaBuilder bldr = BatchSchema.newBuilder().setSelectionVectorMode(BatchSchema.SelectionVectorMode.NONE);
int vectorCount = 0;
for (VectorWrapper<?> v : batchLoaders[0]) {
// add field to the output schema
bldr.addField(v.getField());
// allocate a new value vector
ValueVector outgoingVector = outgoingContainer.addOrGet(v.getField());
outgoingVector.allocateNew();
++vectorCount;
}
schema = bldr.build();
if (schema != null && !schema.equals(schema)) {
// TODO: handle case where one or more batches implicitly indicate schema change
logger.debug("Initial state has incoming batches with different schemas");
}
outgoingContainer.buildSchema(BatchSchema.SelectionVectorMode.NONE);