use of org.apache.drill.exec.vector.DateVector in project drill by apache.
the class StatisticsMergeBatch method buildOutgoingRecordBatch.
/**
* Prepare the outgoing container. Populates the outgoing record batch data.
* Please look at the comments above the class definition which describes the
* incoming/outgoing batch schema
*/
private IterOutcome buildOutgoingRecordBatch() {
for (VectorWrapper<?> vw : container) {
String outputStatName = vw.getField().getName();
// Populate the `schema` and `computed` fields
if (outputStatName.equals(Statistic.SCHEMA)) {
BigIntVector vv = (BigIntVector) vw.getValueVector();
vv.allocateNewSafe();
vv.getMutator().setSafe(0, schema);
} else if (outputStatName.equals(Statistic.COMPUTED)) {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
DateVector vv = (DateVector) vw.getValueVector();
vv.allocateNewSafe();
vv.getMutator().setSafe(0, cal.getTimeInMillis());
} else {
// Populate the rest of the merged statistics. Each statistic is a map which
// contains <COL_NAME, STATS_VALUE> pairs
MapVector vv = (MapVector) vw.getValueVector();
for (MergedStatistic outputStat : mergedStatisticList) {
if (outputStatName.equals(outputStat.getName())) {
outputStat.setOutput(vv);
vv.getMutator().setValueCount(columnsList.size());
break;
}
}
}
}
// Populate the number of records (1) inside the outgoing batch.
container.setValueCount(1);
return IterOutcome.OK;
}
Aggregations