use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class GroupByNodeModel method reset.
/**
* {@inheritDoc}
*/
@Override
protected void reset() {
m_hilite.setMapper(null);
for (final ColumnAggregator colAggr : m_columnAggregators) {
colAggr.reset();
}
m_columnAggregators2Use.clear();
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class NumericOutliersIntervalsCalculator method getGroupByTable.
/**
* Constructs the group by table in accordance with the given settings.
*
* @param inTable the input data table
* @param exec the execution context
* @return the group by table w.r.t. the selected settings
* @throws CanceledExecutionException if the user has canceled the execution
*/
private GroupByTable getGroupByTable(final BufferedDataTable inTable, final ExecutionContext exec) throws CanceledExecutionException {
// get the global settings
final GlobalSettings gSettings = getGlobalSettings(inTable);
// create the column aggregators
final ColumnAggregator[] agg = getAggretators(inTable.getDataTableSpec(), gSettings);
// init and return the GroupByTable obeying the chosen memory settings
final GroupByTable t;
if (m_inMemory) {
t = new MemoryGroupByTable(exec, inTable, Arrays.stream(m_groupColNames).collect(Collectors.toList()), agg, gSettings, false, COLUMN_NAME_POLICY, false);
} else {
t = new BigGroupByTable(exec, inTable, Arrays.stream(m_groupColNames).collect(Collectors.toList()), agg, gSettings, false, COLUMN_NAME_POLICY, false);
}
return t;
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class MovingAggregationNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_winLength.validateSettings(settings);
m_windowType.validateSettings(settings);
m_cumulativeComputing.validateSettings(settings);
m_handleMissings.validateSettings(settings);
m_removeRetainedCols.validateSettings(settings);
m_maxUniqueVals.validateSettings(settings);
m_valueDelimiter.validateSettings(settings);
final List<ColumnAggregator> aggregators = ColumnAggregator.loadColumnAggregators(settings);
final List<DataTypeAggregator> typeAggregators = new LinkedList<>();
final List<PatternAggregator> regexAggregators = new LinkedList<>();
try {
regexAggregators.addAll(PatternAggregator.loadAggregators(settings, CFG_PATTERN_AGGREGATORS));
typeAggregators.addAll(DataTypeAggregator.loadAggregators(settings, CFG_DATA_TYPE_AGGREGATORS));
} catch (InvalidSettingsException e) {
// introduced in 2.11
}
if (aggregators.isEmpty() && regexAggregators.isEmpty() && typeAggregators.isEmpty()) {
throw new IllegalArgumentException("Please select at least one aggregation option");
}
final String policyLabel = ((SettingsModelString) m_columnNamePolicy.createCloneWithValidatedValue(settings)).getStringValue();
final ColumnNamePolicy namePolicy = ColumnNamePolicy.getPolicy4Label(policyLabel);
try {
GroupByNodeModel.checkDuplicateAggregators(namePolicy, aggregators);
} catch (IllegalArgumentException e) {
throw new InvalidSettingsException(e.getMessage());
}
final boolean removeAggrCols = ((SettingsModelBoolean) m_removeAggregationCols.createCloneWithValidatedValue(settings)).getBooleanValue();
if (ColumnNamePolicy.KEEP_ORIGINAL_NAME.equals(namePolicy) && !removeAggrCols) {
throw new InvalidSettingsException("'" + ColumnNamePolicy.KEEP_ORIGINAL_NAME.getLabel() + "' option only valid if aggregation columns are filtered");
}
}
Aggregations