}
@Override
public void addTuple(Tuple t) throws IOException {
checkAndWriteSync();
Column col;
buffer.clear();
nullFlags.clear();
for (int i = 0; i < schema.getColumnNum(); i++) {
if (enabledStats) {
stats.analyzeField(i, t.get(i));
}
if (t.isNull(i)) {
nullFlags.set(i);
} else {
col = schema.getColumn(i);
switch (col.getDataType().getType()) {
case BOOLEAN:
buffer.put(t.getBoolean(i).asByte());
break;
case BIT:
buffer.put(t.getByte(i).asByte());
break;
case CHAR:
byte[] src = t.getChar(i).asByteArray();
byte[] dst = Arrays.copyOf(src, col.getDataType().getLength());
buffer.putInt(src.length);
buffer.put(dst);
break;
case TEXT:
byte [] strbytes = t.getText(i).asByteArray();