use of org.apache.drill.exec.store.EventBasedRecordWriter.FieldConverter in project drill by apache.
the class MetadataControllerBatch method appendStatistics.
private void appendStatistics(StatisticsRecordCollector statisticsCollector) {
if (context.getOptions().getOption(PlannerSettings.STATISTICS_USE)) {
List<FieldConverter> fieldConverters = new ArrayList<>();
int fieldId = 0;
for (VectorWrapper<?> wrapper : right) {
if (wrapper.getField().getName().equalsIgnoreCase(WriterPrel.PARTITION_COMPARATOR_FIELD)) {
continue;
}
FieldReader reader = wrapper.getValueVector().getReader();
FieldConverter converter = StatisticsRecordWriterImpl.getConverter(statisticsCollector, fieldId++, wrapper.getField().getName(), reader);
fieldConverters.add(converter);
}
try {
for (int counter = 0; counter < right.getRecordCount(); counter++) {
statisticsCollector.startStatisticsRecord();
// write the current record
for (FieldConverter converter : fieldConverters) {
converter.setPosition(counter);
converter.startField();
converter.writeField();
converter.endField();
}
statisticsCollector.endStatisticsRecord();
}
} catch (IOException e) {
throw UserException.dataWriteError(e).addContext("Failed to write metadata").build(logger);
}
}
}
Aggregations