use of org.knime.base.data.filter.column.FilterColumnRowInput in project knime-core by knime.
the class AppendedRowsNodeModel method run.
void run(final RowInput[] inputs, final RowOutput output, final ExecutionMonitor exec, final long totalRowCount) throws Exception {
RowInput[] corrected;
if (m_isIntersection) {
final RowInput[] noNullArray = noNullArray(inputs);
corrected = new RowInput[noNullArray.length];
DataTableSpec[] inSpecs = new DataTableSpec[noNullArray.length];
for (int i = 0; i < noNullArray.length; i++) {
inSpecs[i] = noNullArray[i].getDataTableSpec();
}
String[] intersection = getIntersection(inSpecs);
for (int i = 0; i < noNullArray.length; i++) {
corrected[i] = new FilterColumnRowInput(noNullArray[i], intersection);
}
} else {
corrected = inputs;
}
AppendedRowsTable.DuplicatePolicy duplPolicy;
if (m_isFailOnDuplicate) {
duplPolicy = AppendedRowsTable.DuplicatePolicy.Fail;
} else if (m_isAppendSuffix) {
duplPolicy = AppendedRowsTable.DuplicatePolicy.AppendSuffix;
} else {
duplPolicy = AppendedRowsTable.DuplicatePolicy.Skip;
}
AppendedRowsRowInput appendedInput = AppendedRowsRowInput.create(corrected, duplPolicy, m_suffix, exec, totalRowCount);
try {
DataRow next;
// note, this iterator throws runtime exceptions when canceled.
while ((next = appendedInput.poll()) != null) {
// may throw exception, also sets progress
output.push(next);
}
} catch (AppendedRowsIterator.RuntimeCanceledExecutionException rcee) {
throw rcee.getCause();
} finally {
output.close();
}
if (appendedInput.getNrRowsSkipped() > 0) {
setWarningMessage("Filtered out " + appendedInput.getNrRowsSkipped() + " duplicate row(s).");
}
if (m_enableHiliting) {
Map<RowKey, Set<RowKey>> map = createHiliteTranslationMap(appendedInput.getDuplicateNameMap());
m_hiliteTranslator.setMapper(new DefaultHiLiteMapper(map));
}
}
Aggregations