use of org.knime.core.node.streamable.DataTableRowInput in project knime-core by knime.
the class JavaRowSplitterNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
final int rowCount = inData[0].getRowCount();
m_rowCount = rowCount;
DataTableRowInput input = new DataTableRowInput(inData[0]);
DataTableSpec spec = inData[0].getDataTableSpec();
BufferedDataContainer trueMatch = exec.createDataContainer(spec);
BufferedDataTableRowOutput[] outputs;
BufferedDataContainer falseMatch = null;
if (getNrOutPorts() == 2) {
falseMatch = exec.createDataContainer(spec);
}
outputs = Stream.of(trueMatch, falseMatch).filter(f -> f != null).map(f -> new BufferedDataTableRowOutput(f)).toArray(BufferedDataTableRowOutput[]::new);
execute(input, outputs, exec);
BufferedDataTable[] outTables = Stream.of(trueMatch, falseMatch).filter(f -> f != null).map(f -> f.getTable()).toArray(BufferedDataTable[]::new);
return outTables;
}
use of org.knime.core.node.streamable.DataTableRowInput in project knime-core by knime.
the class FilterApplyRowSplitterNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
exec.setProgress(0);
PortObject portObject = inObjects[1];
DataTableSpec filterSpec = portObject == null ? ((BufferedDataTable) inObjects[0]).getDataTableSpec() : ((FilterDefinitionHandlerPortObject) portObject).getSpec();
final BufferedDataTableRowOutput out1 = new BufferedDataTableRowOutput(exec.createDataContainer(((BufferedDataTable) inObjects[0]).getDataTableSpec()));
final BufferedDataTableRowOutput out2 = new BufferedDataTableRowOutput(exec.createDataContainer(((BufferedDataTable) inObjects[0]).getDataTableSpec()));
execute(new DataTableRowInput((BufferedDataTable) inObjects[0]), out1, out2, filterSpec, exec, ((BufferedDataTable) inObjects[0]).size());
return new BufferedDataTable[] { out1.getDataTable(), out2.getDataTable() };
}
use of org.knime.core.node.streamable.DataTableRowInput in project knime-core by knime.
the class FilterApplyRowSplitterNodeModel method createStreamableOperator.
/**
* {@inheritDoc}
*/
@Override
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
return new StreamableOperator() {
@Override
public void runFinal(final PortInput[] inputs, final PortOutput[] outputs, final ExecutionContext exec) throws Exception {
final DataTableRowInput in = (DataTableRowInput) inputs[0];
final RowOutput out1 = (RowOutput) outputs[0];
final RowOutput out2 = (RowOutput) outputs[1];
PortObjectInput portObjectInput = (PortObjectInput) inputs[1];
DataTableSpec filterSpec = portObjectInput == null ? in.getDataTableSpec() : ((FilterDefinitionHandlerPortObject) portObjectInput.getPortObject()).getSpec();
FilterApplyRowSplitterNodeModel.this.execute(in, out1, out2, filterSpec, exec, -1);
}
};
}
use of org.knime.core.node.streamable.DataTableRowInput in project knime-core by knime.
the class LagColumnStreamableOperator method execute.
BufferedDataTable execute(final BufferedDataTable table, final ExecutionContext exec) throws Exception {
long maxRows = table.size();
int maxLag = m_configuration.getLag() * m_configuration.getLagInterval();
if (m_configuration.isSkipInitialIncompleteRows()) {
maxRows -= maxLag;
}
if (!m_configuration.isSkipLastIncompleteRows()) {
maxRows += maxLag;
}
m_maxRows = maxRows;
BufferedDataContainer output = exec.createDataContainer(m_outSpec);
RowInput wrappedInput = new DataTableRowInput(table);
DataContainerPortOutput wrappedOutput = new DataContainerPortOutput(output);
runFinal(new PortInput[] { wrappedInput }, new PortOutput[] { wrappedOutput }, exec);
return wrappedOutput.getTable();
}
use of org.knime.core.node.streamable.DataTableRowInput in project knime-core by knime.
the class ExtractMissingValueCauseNodeModel method execute.
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inObjects, final ExecutionContext exec) throws Exception {
final ColumnRearranger columnRearranger = createColumnRearranger(inObjects[0].getDataTableSpec());
if (!m_isFiltered.getBooleanValue()) {
final BufferedDataTable out = exec.createColumnRearrangeTable(inObjects[0], columnRearranger, exec);
return new BufferedDataTable[] { out };
} else {
exec.setProgress(0);
final BufferedDataTableRowOutput out = new BufferedDataTableRowOutput(exec.createDataContainer(columnRearranger.createSpec()));
execute(new DataTableRowInput(inObjects[0]), out, exec, inObjects[0].size());
return new BufferedDataTable[] { out.getDataTable() };
}
}
Aggregations