private BytesWritable makeValueWritable(Object row) throws Exception { int length = valueEval.length; // Evaluate the value for (int i = 0; i < length; i++) { cachedValues[i] = valueEval[i].evaluate(row); } // Serialize the value return (BytesWritable) valueSerializer.serialize(cachedValues, valueObjectInspector); }
// Serialize the keys and append the tag protected HiveKey toHiveKey(Object obj, int tag, Integer distLength) throws SerDeException { BinaryComparable key = (BinaryComparable) keySerializer.serialize(obj, keyObjectInspector); int keyLength = key.getLength(); if (tag == -1 || skipTag) { keyWritable.set(key.getBytes(), 0, keyLength); } else { keyWritable.setSize(keyLength + 1); System.arraycopy(key.getBytes(), 0, keyWritable.get(), 0, keyLength); keyWritable.get()[keyLength] = tagByte[0]; } keyWritable.setDistKeyLength((distLength == null) ? keyLength : distLength); return keyWritable; }