public static void validateData(List<Record> expected, List<Record> actual, int sortBy) {
    List<Record> sortedExpected = Lists.newArrayList(expected);
    List<Record> sortedActual = Lists.newArrayList(actual);
    // Sort based on the specified column
    sortedExpected.sort(Comparator.comparingInt(record -> record.get(sortBy).hashCode()));
    sortedActual.sort(Comparator.comparingInt(record -> record.get(sortBy).hashCode()));

    Assert.assertEquals(sortedExpected.size(), sortedActual.size());
    validateData(sortedExpected, sortedActual);
  }
Validates whether the 2 sets of records are the same. The results should be sorted by a unique key so we do
not end up with flaky tests.
@param expected The expected list of Records
@param actual The actual list of Records
@param sortBy The column position by which we will sort
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergTestUtils.java