Search in sources :

Example 16 with BufferedDataTableRowOutput

use of org.knime.core.node.streamable.BufferedDataTableRowOutput 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() };
    }
}
Also used : ColumnRearranger(org.knime.core.data.container.ColumnRearranger) BufferedDataTable(org.knime.core.node.BufferedDataTable) DataTableRowInput(org.knime.core.node.streamable.DataTableRowInput) BufferedDataTableRowOutput(org.knime.core.node.streamable.BufferedDataTableRowOutput)

Example 17 with BufferedDataTableRowOutput

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

the class NumericOutliersReviser method treatOutliers.

/**
 * Removes/Retains all rows from the input table that contain outliers. Additionally, the outlier and group related
 * counts, and the new domains are calculated.
 *
 * @param exec the execution context
 * @param in the input data table
 * @param outlierModel the model storing the permitted intervals
 * @return returns the data table whose outliers have been treated
 * @throws Exception any exception to indicate an error, cancelation.
 */
public BufferedDataTable treatOutliers(final ExecutionContext exec, final BufferedDataTable in, final NumericOutliersModel outlierModel) throws Exception {
    final BufferedDataTableRowOutput out = new BufferedDataTableRowOutput(exec.createDataContainer(getOutTableSpec(in.getDataTableSpec())));
    // treat the outliers
    treatOutliers(exec, new DataTableRowInput(in), out, outlierModel, in.size(), false);
    // store the result
    final BufferedDataTable outTable;
    // update the domain if necessary. This cannot be done if we are in streaming mode
    if (updateDomain()) {
        outTable = m_domainUpdater.updateDomain(exec, out.getDataTable());
        m_domainUpdater = null;
    } else {
        outTable = out.getDataTable();
    }
    // set empty table message only if not both tables are empty
    if (outTable.size() == 0 && m_summaryTable.size() > 0) {
        warnListeners(EMPTY_TABLE_WARNING);
    }
    // return the table
    return outTable;
}
Also used : DataTableRowInput(org.knime.core.node.streamable.DataTableRowInput) BufferedDataTable(org.knime.core.node.BufferedDataTable) BufferedDataTableRowOutput(org.knime.core.node.streamable.BufferedDataTableRowOutput)

Example 18 with BufferedDataTableRowOutput

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

the class DateTimeDifferenceNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    if (m_modusSelectModel.getStringValue().equals(ModusOptions.UsePreviousRow.name())) {
        final BufferedDataTableRowOutput out = new BufferedDataTableRowOutput(exec.createDataContainer(new DataTableSpecCreator(inData[0].getDataTableSpec()).addColumns(createColumnSpec(inData[0].getDataTableSpec())).createSpec()));
        execute(new DataTableRowInput(inData[0]), out, exec, inData[0].size());
        return new BufferedDataTable[] { out.getDataTable() };
    } else {
        final ColumnRearranger r = createColumnRearranger(inData[0].getDataTableSpec());
        final BufferedDataTable out = exec.createColumnRearrangeTable(inData[0], r, exec);
        return new BufferedDataTable[] { out };
    }
}
Also used : ColumnRearranger(org.knime.core.data.container.ColumnRearranger) DataTableSpecCreator(org.knime.core.data.DataTableSpecCreator) DataTableRowInput(org.knime.core.node.streamable.DataTableRowInput) BufferedDataTable(org.knime.core.node.BufferedDataTable) BufferedDataTableRowOutput(org.knime.core.node.streamable.BufferedDataTableRowOutput)

Aggregations

BufferedDataTableRowOutput (org.knime.core.node.streamable.BufferedDataTableRowOutput)18 DataTableRowInput (org.knime.core.node.streamable.DataTableRowInput)14 BufferedDataTable (org.knime.core.node.BufferedDataTable)13 DataTableSpec (org.knime.core.data.DataTableSpec)9 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)8 RowInput (org.knime.core.node.streamable.RowInput)6 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)4 RowOutput (org.knime.core.node.streamable.RowOutput)4 DataRow (org.knime.core.data.DataRow)3 DataCell (org.knime.core.data.DataCell)2 RowKey (org.knime.core.data.RowKey)2 PortObject (org.knime.core.node.port.PortObject)2 FilterDefinitionHandlerPortObject (org.knime.core.node.port.viewproperty.FilterDefinitionHandlerPortObject)2 PartitionInfo (org.knime.core.node.streamable.PartitionInfo)2 PortInput (org.knime.core.node.streamable.PortInput)2 PortOutput (org.knime.core.node.streamable.PortOutput)2 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)2 SimpleStreamableOperatorInternals (org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals)2 File (java.io.File)1 IOException (java.io.IOException)1