/** * After vectorized batch is processed, can return the key that caused a particular row * to be forwarded. Because the row could only be marked to forward because it has * the same key with some row already in the heap (for GBY), we can use that key from the * heap to emit the forwarded row. * @param batchIndex index of the key in the batch. * @return The key corresponding to the index. */ public HiveKey getVectorizedKeyToForward(int batchIndex) { int index = MAY_FORWARD - batchIndexToResult[batchIndex]; HiveKey hk = new HiveKey(); hk.set(keys[index], 0, keys[index].length); hk.setHashCode(hashes[index]); hk.setDistKeyLength(distKeyLengths[index]); return hk; }
/** * After vectorized batch is processed, can return the key that caused a particular row * to be forwarded. Because the row could only be marked to forward because it has * the same key with some row already in the heap (for GBY), we can use that key from the * heap to emit the forwarded row. * @param batchIndex index of the key in the batch. * @return The key corresponding to the index. */ public HiveKey getVectorizedKeyToForward(int batchIndex) { int index = MAY_FORWARD - batchIndexToResult[batchIndex]; HiveKey hk = new HiveKey(); hk.set(keys[index], 0, keys[index].length); hk.setHashCode(hashes[index]); hk.setDistKeyLength(distKeyLengths[index]); return hk; }
protected void initializeEmptyKey(int tag) { // Use the same logic as ReduceSinkOperator.toHiveKey. // if (tag == -1 || reduceSkipTag) { keyWritable.setSize(0); } else { keyWritable.setSize(1); keyWritable.get()[0] = reduceTagByte; } keyWritable.setDistKeyLength(0); keyWritable.setHashCode(0); }
public static HiveKey copyHiveKey(HiveKey key) { HiveKey copy = new HiveKey(); copy.setDistKeyLength(key.getDistKeyLength()); copy.setHashCode(key.hashCode()); copy.set(key); return copy; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey(input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey( input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey(input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey( input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
public static HiveKey copyHiveKey(HiveKey key) { HiveKey copy = new HiveKey(); copy.setDistKeyLength(key.getDistKeyLength()); copy.setHashCode(key.hashCode()); copy.set(key); return copy; }
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; }
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; }
private void processKey(VectorizedRowBatch batch, int batchIndex, int tag) throws HiveException{ if (isEmptyKey) return; try { keyBinarySortableSerializeWrite.reset(); keyVectorSerializeRow.serializeWrite(batch, batchIndex); // One serialized key for 1 or more rows for the duplicate keys. final int keyLength = keyOutput.getLength(); if (tag == -1 || reduceSkipTag) { keyWritable.set(keyOutput.getData(), 0, keyLength); } else { keyWritable.setSize(keyLength + 1); System.arraycopy(keyOutput.getData(), 0, keyWritable.get(), 0, keyLength); keyWritable.get()[keyLength] = reduceTagByte; } keyWritable.setDistKeyLength(keyLength); } catch (Exception e) { throw new HiveException(e); } }
keyWritable.get()[keyLength] = reduceTagByte; keyWritable.setDistKeyLength(keyLength); keyWritable.setHashCode(hashCode);
keyWritable.get()[nullBytes.length] = reduceTagByte; keyWritable.setDistKeyLength(nullBytes.length); keyWritable.setHashCode(nullKeyHashCode); keyWritable.get()[keyLength] = reduceTagByte; keyWritable.setDistKeyLength(keyLength); keyWritable.setHashCode(serializedKeySeries.getCurrentHashCode());
keyWritable.get()[nullBytes.length] = reduceTagByte; keyWritable.setDistKeyLength(nullBytes.length); keyWritable.setHashCode(nullKeyHashCode); keyWritable.get()[keyLength] = reduceTagByte; keyWritable.setDistKeyLength(keyLength); keyWritable.setHashCode(serializedKeySeries.getCurrentHashCode());
/** * After vectorized batch is processed, can return the key that caused a particular row * to be forwarded. Because the row could only be marked to forward because it has * the same key with some row already in the heap (for GBY), we can use that key from the * heap to emit the forwarded row. * @param batchIndex index of the key in the batch. * @return The key corresponding to the index. */ public HiveKey getVectorizedKeyToForward(int batchIndex) { int index = MAY_FORWARD - batchIndexToResult[batchIndex]; HiveKey hk = new HiveKey(); hk.set(keys[index], 0, keys[index].length); hk.setHashCode(hashes[index]); hk.setDistKeyLength(distKeyLengths[index]); return hk; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey(input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
public static HiveKey copyHiveKey(HiveKey key) { HiveKey copy = new HiveKey(); copy.setDistKeyLength(key.getDistKeyLength()); copy.setHashCode(key.hashCode()); copy.set(key); return copy; }
private HiveKey readHiveKey(Input input) { HiveKey hiveKey = new HiveKey( input.readBytes(input.readInt()), input.readInt()); hiveKey.setDistKeyLength(input.readInt()); return hiveKey; }
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; }