/** * Encodes a single column of a row into the output buffer. * @param row the row being encoded * @param columnIdx the column index of the column to encode * @param isLast whether the column is the last component of the key */ private static void encodeColumn(PartialRow row, int columnIdx, boolean isLast, ByteVec buf) { final Schema schema = row.getSchema(); final ColumnSchema column = schema.getColumnByIndex(columnIdx); if (!row.isSet(columnIdx)) { throw new IllegalStateException(String.format("Primary key column %s is not set", column.getName())); } final Type type = column.getType(); if (type == Type.STRING || type == Type.BINARY) { encodeBinary(row.getVarLengthData().get(columnIdx), isLast, buf); } else { encodeSignedInt(row.getRowAlloc(), schema.getColumnOffset(columnIdx), column.getTypeSize(), buf); } }