use of org.knime.core.data.container.filter.TableFilter in project knime-core by knime.
the class JoinedTable method checkRowKeysMatch.
private static void checkRowKeysMatch(final BufferedDataTable left, final BufferedDataTable right, final ExecutionMonitor prog, final long cnt) throws CanceledExecutionException {
final TableFilter filter = TableFilter.materializeCols();
// check if rows come in same order
try (CloseableRowIterator leftIt = left.filter(filter).iterator();
CloseableRowIterator rightIt = right.filter(filter).iterator()) {
long rowIndex = 0;
while (leftIt.hasNext()) {
RowKey leftKey = leftIt.next().getKey();
RowKey rightKey = rightIt.next().getKey();
if (!leftKey.equals(rightKey)) {
throw new IllegalArgumentException("Tables contain non-matching rows or are sorted differently, keys in row " + rowIndex + " do not match: \"" + leftKey + "\" vs. \"" + rightKey + "\"");
}
prog.checkCanceled();
final long finalRowIndex = rowIndex;
prog.setProgress(rowIndex / (double) cnt, () -> "\"" + leftKey + "\" (" + finalRowIndex + "/" + cnt + ")");
rowIndex++;
}
}
}
Aggregations