/*
@Override
public int partitionHash(Object[] args)
{
if (_keyExpr == null) {
return -1;
}

return _keyExpr.partitionHash(args);
}
192109
@Override
  public void exec(Result<Object> result, Object ...args)
  {
    TableKelp tableKelp = _table.getTableKelp();
    
    RowCursor minCursor = tableKelp.cursor();
    RowCursor maxCursor = tableKelp.cursor();
    
    minCursor.clear();
    maxCursor.setKeyMax();
    
    _keyExpr.fillMinCursor(minCursor, args);
    _keyExpr.fillMaxCursor(maxCursor, args);
    
    //QueryKelp whereKelp = _whereExpr.bind(args);
    // XXX: binding should be with unique
    EnvKelp whereKelp = new EnvKelp(_whereKelp, args);

    //tableKelp.findOne(minCursor, maxCursor, whereKelp,
    //                  result.from((cursor,r)->remove(cursor,r)));
    
    BackupKelp backup = _table.getBackupCallback();
    
    if (isStaticNode()) {
      tableKelp.remove(minCursor, backup, (Result) result);
    }
    else {
      tableKelp.removeRange(minCursor, maxCursor, whereKelp, backup,
                            (Result) result);
    }
    
    // result.completed(null);
  }
688112
@Override
  public Long sdiffstore(final byte[] dstkey, final byte[]... keys) {
    checkIsInMultiOrPipeline();
    client.sdiffstore(dstkey, keys);
    return client.getIntegerReply();
  }
1255396
@Override
	public int hash(T value) {
		int i = 0;
		try {
			int code = this.comparators[0].hash(value.getField(keyPositions[0]));
			
			for (i = 1; i < this.keyPositions.length; i++) {
				code *= HASH_SALT[i & 0x1F]; // salt code with (i % HASH_SALT.length)-th salt component
				code += this.comparators[i].hash(value.getField(keyPositions[i]));
			}
			return code;
		}
		catch (NullPointerException npex) {
			throw new NullKeyFieldException(keyPositions[i]);
		}
		catch (IndexOutOfBoundsException iobex) {
			throw new KeyFieldOutOfBoundsException(keyPositions[i]);
		}
	}
784729
private <K> DataStream<T> partitionCustom(Partitioner<K> partitioner, Keys<T> keys) {
		KeySelector<T, K> keySelector = KeySelectorUtil.getSelectorForOneKey(keys, partitioner, getType(), getExecutionConfig());

		return setConnectionType(
				new CustomPartitionerWrapper<>(
						clean(partitioner),
						clean(keySelector)));
	}
271503
@Override
    public int compareTo(Sha1Wrapper arg0) {
        if (arg0 == null) return 1;
        for (int i = 0; i < 20; i++) {
            int cmp = hashBytes[i] - arg0.hashBytes[i];
            if (cmp != 0) return cmp;
        }
        return 0;
    }
945701
private static int arrayMemberHash(final Class<?> componentType, final Object o) {
        if (componentType.equals(Byte.TYPE)) {
            return Arrays.hashCode((byte[]) o);
        }
        if (componentType.equals(Short.TYPE)) {
            return Arrays.hashCode((short[]) o);
        }
        if (componentType.equals(Integer.TYPE)) {
            return Arrays.hashCode((int[]) o);
        }
        if (componentType.equals(Character.TYPE)) {
            return Arrays.hashCode((char[]) o);
        }
        if (componentType.equals(Long.TYPE)) {
            return Arrays.hashCode((long[]) o);
        }
        if (componentType.equals(Float.TYPE)) {
            return Arrays.hashCode((float[]) o);
        }
        if (componentType.equals(Double.TYPE)) {
            return Arrays.hashCode((double[]) o);
        }
        if (componentType.equals(Boolean.TYPE)) {
            return Arrays.hashCode((boolean[]) o);
        }
        return Arrays.hashCode((Object[]) o);
    }
1329311
@SuppressWarnings("unchecked")
    private Segment<K,V> segmentForHash(int h) {
        long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE;
        return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u);
    }
243010
public static String getMd5Hash(String topic, String[] partitions) {
      ArrayList<String> elements = new ArrayList<String>();
      elements.add(topic);
      for (String partition : partitions) {
        elements.add(partition);
      }
      String pathPrefix = StringUtils.join(elements, "/");
      try {
        final MessageDigest messageDigest = MessageDigest.getInstance("MD5");
        byte[] md5Bytes = messageDigest.digest(pathPrefix.getBytes("UTF-8"));
        return getHexEncode(md5Bytes).substring(0, 4);
      } catch (NoSuchAlgorithmException e) {
        LOG.error(e.getMessage());
      } catch (UnsupportedEncodingException e) {
        LOG.error(e.getMessage());
      }
      return "";
    }
517158
@SuppressWarnings("unchecked")
    static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) {
        HashEntry<K,V>[] tab;
        return (seg == null || (tab = seg.table) == null) ? null :
            (HashEntry<K,V>) UNSAFE.getObjectVolatile
            (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE);
    }
515201
function processPartitionKeys(keys){
    var result = "(",
        j,
        len,
        keyGroup;

    if(typeof keys === 'string'){
        return result += keys + ")";
    }

    len = keys.length;
    for(j = 0; j< keys.length; j++){
        keyGroup = keys[j];
        if(keyGroup instanceof Array){
            result += "(";
            result += keyGroup.join(", ");
            result += ")";
        }else{
            result += keyGroup;
        }
        result += (j < len-1) ? ", " : "";
    }
    result += ")";

    return result;
}
185639
@Override @Nullable
    public KeyCrypter getKeyCrypter() {
        if (keyCrypter != null)
            return keyCrypter;
        else if (parent != null)
            return parent.getKeyCrypter();
        else
            return null;
    }
17833
private static int partitionForKey(byte[] key, int numPartitions) {
        CRC32 crc32 = new CRC32();
        crc32.update(key);
        long rv = (crc32.getValue() >> 16) & 0x7fff;
        return (int) rv &numPartitions - 1;
    }
1030294
long get(final T key) {
    if (key == null) { return 0; }
    final int probe = hashProbe(key);
    if (states[probe] > 0) {
      assert (keys[probe]).equals(key);
      return values[probe];
    }
    return 0;
  }
45087
public String[] getPartitionKeys(String location, Job job) throws IOException
    {
        if (!usePartitionFilter)
            return null;
        List<ColumnDef> indexes = getIndexes();
        String[] partitionKeys = new String[indexes.size()];
        for (int i = 0; i < indexes.size(); i++)
        {
            partitionKeys[i] = new String(indexes.get(i).getName());
        }
        return partitionKeys;
    }
549605
public static int getPodHash(String key)
  {
    byte []buffer = new byte[16];
    
    int sublen = Math.min(key.length(), 8);
    
    for (int i = 0; i < sublen; i++) {
      buffer[i] = (byte) key.charAt(i);
    }
    
    long hash = Murmur64.generate(Murmur64.SEED, key);
    
    BitsUtil.writeLong(buffer, 8, hash);
    
    return calculatePodHash(buffer, 0, 16);
  }
485220
def argshash(self, args, kwargs):
        ""
        a = repr(args)
        b = repr(sorted((repr(k), repr(v)) for k, v in kwargs.items()))
        return a + b
1293220
@Override
  public
  /*! #else protected #end !*/
  int hashKey(KType key) {
    assert !Intrinsics.isEmpty(key); // Handled as a special case (empty slot marker).
    return BitMixer.mix(key, this.keyMixer);
  }