Search in sources :

Example 6 with PortObjectOutput

use of org.knime.core.node.streamable.PortObjectOutput in project knime-core by knime.

the class BinnerNodeModel 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 {
            ColumnRearranger colre = createColumnRearranger((DataTableSpec) inSpecs[0]);
            colre.createStreamableFunction(0, 0).runFinal(inputs, outputs, exec);
            if (m_pmmlOutEnabled) {
                // handle the optional PMML in port (can be null)
                PMMLPortObject inPMMLPort = m_pmmlInEnabled ? (PMMLPortObject) ((PortObjectInput) inputs[1]).getPortObject() : null;
                PMMLPortObject outPMMLPort = createPMMLModel(inPMMLPort, (DataTableSpec) inSpecs[0], colre.createSpec());
                ((PortObjectOutput) outputs[1]).setPortObject(outPMMLPort);
            }
        }
    };
}
Also used : ExecutionContext(org.knime.core.node.ExecutionContext) ColumnRearranger(org.knime.core.data.container.ColumnRearranger) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) StreamableOperator(org.knime.core.node.streamable.StreamableOperator) PortObjectInput(org.knime.core.node.streamable.PortObjectInput) PortObjectOutput(org.knime.core.node.streamable.PortObjectOutput)

Aggregations

PortObjectOutput (org.knime.core.node.streamable.PortObjectOutput)6 ExecutionContext (org.knime.core.node.ExecutionContext)5 PMMLPortObject (org.knime.core.node.port.pmml.PMMLPortObject)5 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)5 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)4 DataTableSpec (org.knime.core.data.DataTableSpec)2 PortObject (org.knime.core.node.port.PortObject)2 InactiveBranchPortObject (org.knime.core.node.port.inactive.InactiveBranchPortObject)2 PortObjectInput (org.knime.core.node.streamable.PortObjectInput)2 DataRow (org.knime.core.data.DataRow)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1 PMMLPortObjectSpecCreator (org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator)1 DerivedFieldMapper (org.knime.core.node.port.pmml.preproc.DerivedFieldMapper)1 DataTableRowInput (org.knime.core.node.streamable.DataTableRowInput)1 RowInput (org.knime.core.node.streamable.RowInput)1 RowOutput (org.knime.core.node.streamable.RowOutput)1 StreamableFunction (org.knime.core.node.streamable.StreamableFunction)1 StreamableOperatorInternals (org.knime.core.node.streamable.StreamableOperatorInternals)1