use of org.apache.drill.exec.store.StatisticsRecordWriterImpl in project drill by apache.
the class StatisticsWriterRecordBatch method setupNewSchema.
protected void setupNewSchema() {
try {
// update the schema in RecordWriter
stats.startSetup();
recordWriter.updateSchema(incoming);
// Create two vectors for:
// 1. Fragment unique id.
// 2. Summary: currently contains number of records written.
final MaterializedField fragmentIdField = MaterializedField.create("Fragment", Types.required(TypeProtos.MinorType.VARCHAR));
final MaterializedField summaryField = MaterializedField.create("Number of records written", Types.required(TypeProtos.MinorType.BIGINT));
container.addOrGet(fragmentIdField);
container.addOrGet(summaryField);
container.buildSchema(BatchSchema.SelectionVectorMode.NONE);
} finally {
stats.stopSetup();
}
try {
statsRecordWriterImpl = new StatisticsRecordWriterImpl(incoming, recordWriter);
} catch (IOException e) {
throw UserException.dataWriteError(e).addContext("Failure when creating the statistics record writer").build(logger);
}
container.buildSchema(BatchSchema.SelectionVectorMode.NONE);
schema = container.getSchema();
}
Aggregations