@Override public void readFields(DataInput in) throws IOException { // read head (rows, cols) _numRows = in.readInt(); int numCols = in.readInt(); // read columns (value type, data) _schema.clear(); _coldata.clear(); for (int j = 0; j < numCols; j++) { ValueType vt = ValueType.values()[in.readByte()]; String name = in.readUTF(); Array arr = null; switch (vt) { case STRING: arr = new StringArray(new String[_numRows]); break; case BOOLEAN: arr = new BooleanArray(new boolean[_numRows]); break; case INT: arr = new LongArray(new long[_numRows]); break; case DOUBLE: arr = new DoubleArray(new double[_numRows]); break; default: throw new IOException("Unsupported value type: " + vt); } arr.readFields(in); _schema.add(vt); _colnames.add(name); _coldata.add(arr); } }