use of org.apache.drill.exec.record.VectorWrapper in project drill by apache.
the class ParquetResultListener method printRowMajor.
public void printRowMajor(RecordBatchLoader batchLoader) {
for (int i = 0; i < batchLoader.getRecordCount(); i++) {
if (i % 50 == 0) {
System.out.println();
for (VectorWrapper vw : batchLoader) {
ValueVector v = vw.getValueVector();
System.out.print(Strings.padStart(v.getField().getPath(), 20, ' ') + " ");
}
System.out.println();
System.out.println();
}
for (final VectorWrapper vw : batchLoader) {
final ValueVector v = vw.getValueVector();
Object o = v.getAccessor().getObject(i);
if (o instanceof byte[]) {
try {
// TODO - in the dictionary read error test there is some data that does not look correct
// the output of our reader matches the values of the parquet-mr cat/head tools (no full comparison was made,
// but from a quick check of a few values it looked consistent
// this might have gotten corrupted by pig somehow, or maybe this is just how the data is supposed ot look
// TODO - check this!!
// for (int k = 0; k < ((byte[])o).length; k++ ) {
// // check that the value at each position is a valid single character ascii value.
//
// if (((byte[])o)[k] > 128) {
// System.out.println("batch: " + batchCounter + " record: " + recordCount);
// }
// }
o = new String((byte[]) o, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
System.out.print(Strings.padStart(o + "", 20, ' ') + " ");
}
System.out.println();
}
}
Aggregations