@Test
  public void testExceptionThrownOnMismatchedPartialResults() throws IOException {
    assertTrue(NUM_ROWS >= 2);

    ArrayList<Result> partials = new ArrayList<>();
    Scan scan = new Scan();
    scan.setMaxResultSize(Long.MAX_VALUE);
    ResultScanner scanner = TABLE.getScanner(scan);
    Result r1 = scanner.next();
    partials.add(r1);
    Result r2 = scanner.next();
    partials.add(r2);

    assertFalse(Bytes.equals(r1.getRow(), r2.getRow()));

    try {
      Result.createCompleteResult(partials);
      fail("r1 and r2 are from different rows. It should not be possible to combine them into"
        + " a single result");
    } catch (IOException e) {
    }

    scanner.close();
  }
When reconstructing the complete result from its partials we ensure that the row of each
partial result is the same. If one of the rows differs, an exception is thrown.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java