use of org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals in project knime-core by knime.
the class RegexSplitNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
SimpleStreamableOperatorInternals internals = createStreamingOperatorInternals();
ColumnRearranger rearranger = createColumnRearranger(inData[0].getSpec(), internals);
BufferedDataTable t = exec.createColumnRearrangeTable(inData[0], rearranger, exec);
warningMessage(internals);
return new BufferedDataTable[] { t };
}
use of org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals in project knime-core by knime.
the class RegexSplitNodeModel method mergeStreamingOperatorInternals.
/**
* {@inheritDoc}
*/
@Override
protected SimpleStreamableOperatorInternals mergeStreamingOperatorInternals(final SimpleStreamableOperatorInternals[] operatorInternals) {
int errorCount = 0;
for (int i = 0; i < operatorInternals.length; i++) {
try {
errorCount += operatorInternals[i].getConfig().getInt(CONFIG_KEY_ERRORCOUNT);
} catch (InvalidSettingsException e) {
// should not happen since the error count config should be set every time even though its 0
throw new RuntimeException(e);
}
}
SimpleStreamableOperatorInternals res = new SimpleStreamableOperatorInternals();
res.getConfig().addInt(CONFIG_KEY_ERRORCOUNT, errorCount);
return res;
}
use of org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals in project knime-core by knime.
the class AbstractConditionalStreamingNodeModel method createMergeOperator.
/**
* {@inheritDoc}
*/
@Override
public MergeOperator createMergeOperator() {
return new MergeOperator() {
/**
* {@inheritDoc}
*/
@Override
public StreamableOperatorInternals mergeIntermediate(final StreamableOperatorInternals[] operators) {
// sum up the row counts if necessary
long count = 0;
for (int i = 0; i < operators.length; i++) {
SimpleStreamableOperatorInternals simpleInternals = (SimpleStreamableOperatorInternals) operators[i];
CheckUtils.checkState(simpleInternals.getConfig().containsKey(CFG_ROW_COUNT), "Config for key " + CFG_ROW_COUNT + " isn't set.");
try {
count += simpleInternals.getConfig().getLong(CFG_ROW_COUNT);
} catch (InvalidSettingsException e) {
// should not happen since we checked already
throw new RuntimeException(e);
}
}
SimpleStreamableOperatorInternals res = new SimpleStreamableOperatorInternals();
if (count > 0) {
res.getConfig().addLong(CFG_ROW_COUNT, count);
}
return res;
}
@Override
public StreamableOperatorInternals mergeFinal(final StreamableOperatorInternals[] operators) {
// nothing to do here
return null;
}
};
}
use of org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals in project knime-core by knime.
the class DoubleToIntNodeModel method mergeStreamingOperatorInternals.
/**
* {@inheritDoc}
*
* @since 3.1
*/
@Override
protected SimpleStreamableOperatorInternals mergeStreamingOperatorInternals(final SimpleStreamableOperatorInternals[] operatorInternals) {
// merge warning messages from potentially different partitions -> essentially concatenate the messages
StringBuilder sb = new StringBuilder();
for (SimpleStreamableOperatorInternals oi : operatorInternals) {
WarningMessage wm = (WarningMessage) oi;
if (wm.get() != null) {
sb.append(wm.get());
sb.append("\n");
}
}
WarningMessage res = new WarningMessage();
res.set(sb.toString());
return res;
}
use of org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals in project knime-core by knime.
the class ReferenceColumnResorterNodeModel method readOrderFromStreamableOperatorInternals.
/**
* @param internals
* @return
*/
private static String[] readOrderFromStreamableOperatorInternals(final StreamableOperatorInternals internals) {
SimpleStreamableOperatorInternals i = (SimpleStreamableOperatorInternals) internals;
String[] order = i.getConfig().getStringArray("order", (String[]) null);
return order;
}
Aggregations