@Override
 public boolean isSingleRow() {
   if (!hashMapResult.hasRows()) {
     return (dummyRow != null);
   }
   return hashMapResult.isSingleRow();
 }
 @Override
 public void addRow(List<Object> t) {
   if (dummyRow != null || hashMapResult.hasRows()) {
     throw new RuntimeException("Cannot add rows when not empty");
   }
   dummyRow = t;
 }
 @Override
 public void clearRows() {
   // Doesn't clear underlying hashtable
   hashMapResult.forget();
   dummyRow = null;
   aliasFilter = (byte) 0xff;
 }
    @Override
    public List<Object> next() throws HiveException {

      WriteBuffers.ByteSegmentRef byteSegmentRef = hashMapResult.next();
      if (byteSegmentRef == null) {
        return null;
      } else {
        return unpack(byteSegmentRef);
      }
    }
    public JoinUtil.JoinResult setFromOutput(Output output) {

      aliasFilter = hashMap.getValueResult(output.getData(), 0, output.getLength(), hashMapResult);
      dummyRow = null;
      if (hashMapResult.hasRows()) {
        return JoinUtil.JoinResult.MATCH;
      } else {
        aliasFilter = (byte) 0xff;
        return JoinUtil.JoinResult.NOMATCH;
      }
    }
    public JoinUtil.JoinResult setDirect(
        byte[] bytes, int offset, int length, BytesBytesMultiHashMap.Result hashMapResult) {

      int keyHash = WriteBuffers.murmurHash(bytes, offset, length);
      aliasFilter = hashMap.getValueResult(bytes, offset, length, hashMapResult);
      dummyRow = null;
      if (hashMapResult.hasRows()) {
        return JoinUtil.JoinResult.MATCH;
      } else {
        aliasFilter = (byte) 0xff;
        return JoinUtil.JoinResult.NOMATCH;
      }
    }
    // Implementation of row iterator
    @Override
    public List<Object> first() throws HiveException {

      // A little strange that we forget the dummy row on read.
      if (dummyRow != null) {
        List<Object> result = dummyRow;
        dummyRow = null;
        return result;
      }

      WriteBuffers.ByteSegmentRef byteSegmentRef = hashMapResult.first();
      if (byteSegmentRef == null) {
        return null;
      } else {
        return unpack(byteSegmentRef);
      }
    }
 @Override
 public boolean hasRows() {
   return hashMapResult.hasRows() || (dummyRow != null);
 }