@Test public void buildMapMixKeyValueColumns() { List<ColumnMetadata> columns = ImmutableList.of( new ColumnMetadata("key", Schema.STRING, "desc", true, false), new ColumnMetadata("both", Schema.STRING, "desc", true, true), new ColumnMetadata("value", Schema.STRING, "desc", false, true)); Row row1 = Row.of("key", "key1", "both", "both1", "value", "value1"); Row row2 = Row.of("key", "key2", "both", "both2", "value", "value2"); Rows rows = new Rows().add(row1).add(row2); Map<List<Object>, List<Row>> map = TableDiff.buildMap(rows, columns); assertThat(map.get(ImmutableList.of("key1", "both1")), equalTo(ImmutableList.of(row1))); assertNull(map.get(ImmutableList.of("key1"))); assertNull(map.get(ImmutableList.of("key1", "both2"))); }
@VisibleForTesting static Map<List<Object>, List<Row>> buildMap(Rows rows, List<ColumnMetadata> metadata) { Map<List<Object>, List<Row>> map = new HashMap<>(); Iterator<Row> iterator = rows.iterator(); while (iterator.hasNext()) { Row row = iterator.next(); map.computeIfAbsent(row.getKey(metadata), k -> new LinkedList<>()).add(row); } return map; }
TableDiff { @VisibleForTesting static Map<List<Object>, List<Row>> buildMap(Rows rows, List<ColumnMetadata> metadata) { Map<List<Object>, List<Row>> map = new HashMap<>(); Iterator<Row> iterator = rows.iterator(); while (iterator.hasNext()) { Row row = iterator.next(); map.computeIfAbsent(row.getKey(metadata), k -> new LinkedList<>()).add(row); } return map; } }
TableDiff { @VisibleForTesting static Map<List<Object>, List<Row>> buildMap(Rows rows, List<ColumnMetadata> metadata) { Map<List<Object>, List<Row>> map = new HashMap<>(); Iterator<Row> iterator = rows.iterator(); while (iterator.hasNext()) { Row row = iterator.next(); map.computeIfAbsent(row.getKey(metadata), k -> new LinkedList<>()).add(row); } return map; } private  TableDiff(); }
TableDiff { @VisibleForTesting static Map<List<Object>, List<Row>> buildMap(Rows rows, List<ColumnMetadata> metadata) { Map<List<Object>, List<Row>> map = new HashMap<>(); Iterator<Row> iterator = rows.iterator(); while (iterator.hasNext()) { Row row = iterator.next(); map.computeIfAbsent(row.getKey(metadata), k -> new LinkedList<>()).add(row); } return map; } private  TableDiff(); static String baseColumnName(String originalColumnName); static String deltaColumnName(String originalColumnName); static TableMetadata diffMetadata(TableMetadata inputMetadata); static TableAnswerElement diffTables(
      TableAnswerElement baseTable, TableAnswerElement deltaTable, boolean includeOneTableKeys); }
TableDiff { @VisibleForTesting static Map<List<Object>, List<Row>> buildMap(Rows rows, List<ColumnMetadata> metadata) { Map<List<Object>, List<Row>> map = new HashMap<>(); Iterator<Row> iterator = rows.iterator(); while (iterator.hasNext()) { Row row = iterator.next(); map.computeIfAbsent(row.getKey(metadata), k -> new LinkedList<>()).add(row); } return map; } private  TableDiff(); static String baseColumnName(String originalColumnName); static String deltaColumnName(String originalColumnName); static TableMetadata diffMetadata(TableMetadata inputMetadata); static TableAnswerElement diffTables(
      TableAnswerElement baseTable, TableAnswerElement deltaTable, boolean includeOneTableKeys); static final String COL_BASE_PREFIX; static final String COL_DELTA_PREFIX; static final String COL_KEY_PRESENCE; static final String COL_KEY_PRESENCE_DESC; static final String COL_KEY_STATUS_BOTH; static final String COL_KEY_STATUS_ONLY_BASE; static final String COL_KEY_STATUS_ONLY_DELTA; }