processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/StreamingMergeSortedGrouper.java
/**
   * Checks two keys contained in the given buffers are same.
   *
   * @param curKeyBuffer the buffer for the given key from {@link #aggregate(Object)}
   * @param buffer       the whole array buffer
   * @param bufferOffset the key offset of the buffer
   *
   * @return true if the two buffers are same.
   */
Checks two keys contained in the given buffers are same.
@param curKeyBuffer the buffer for the given key from  #aggregate(Object)
@param buffer       the whole array buffer
@param bufferOffset the key offset of the buffer

@return true if the two buffers are same.
Checks two keys contained in the given buffers are same . @param curKeyBuffer the buffer for the given key from #aggregate ( Object ) @param buffer the whole array buffer @param bufferOffset the key offset of the buffer @return true if the two buffers are same .
private boolean keyEquals(ByteBuffer curKeyBuffer, ByteBuffer buffer, int bufferOffset)
  {
    int i = 0;
    for (; i + Long.BYTES <= keySize; i += Long.BYTES) {
      if (curKeyBuffer.getLong(i) != buffer.getLong(bufferOffset + i)) {
        return false;
      }
    }
    if (i + Integer.BYTES <= keySize) {
      if (curKeyBuffer.getInt(i) != buffer.getInt(bufferOffset + i)) {
        return false;
      }
      i += Integer.BYTES;
    }
    for (; i < keySize; i++) {
      if (curKeyBuffer.get(i) != buffer.get(bufferOffset + i)) {
        return false;
      }
    }
    return true;
  }
private boolean keyEquals ( ByteBuffer curKeyBuffer , ByteBuffer buffer , int bufferOffset ) { int i = 0 ; for ( ; i + Long . BYTES <= keySize ; i += Long . BYTES ) { if ( curKeyBuffer . getLong ( i ) != buffer . getLong ( bufferOffset + i ) ) { return false ; } } if ( i + Integer . BYTES <= keySize ) { if ( curKeyBuffer . getInt ( i ) != buffer . getInt ( bufferOffset + i ) ) { return false ; } i += Integer . BYTES ; } for ( ; i < keySize ; i ++ ) { if ( curKeyBuffer . get ( i ) != buffer . get ( bufferOffset + i ) ) { return false ; } } return true ; }
Checks two keys contained in the given buffers are same.
Checks two keys contained in the given buffers are same .
// Since this method is frequently called per each input row, the compare performance matters. // This can be called at most once because we already compared using getLong() in the above.