public abstract class GroupByTable extends Object
Modifier | Constructor and Description |
---|---|
protected |
GroupByTable(ExecutionContext exec,
BufferedDataTable inDataTable,
List<String> groupByCols,
ColumnAggregator[] colAggregators,
GlobalSettings globalSettings,
boolean sortInMemory,
boolean enableHilite,
ColumnNamePolicy colNamePolicy,
boolean retainOrder)
Deprecated.
sortInMemory option is no longer required
|
protected |
GroupByTable(ExecutionContext exec,
BufferedDataTable inDataTable,
List<String> groupByCols,
ColumnAggregator[] colAggregators,
GlobalSettings globalSettings,
boolean enableHilite,
ColumnNamePolicy colNamePolicy,
boolean retainOrder)
Constructor for class GroupByTable.
|
protected GroupByTable(ExecutionContext exec, BufferedDataTable inDataTable, List<String> groupByCols, ColumnAggregator[] colAggregators, GlobalSettings globalSettings, boolean enableHilite, ColumnNamePolicy colNamePolicy, boolean retainOrder) throws CanceledExecutionException
exec
- the ExecutionContext
inDataTable
- the table to aggregategroupByCols
- the name of all columns to group bycolAggregators
- the aggregation columns with the aggregation method
to use in the order the columns should be appear in the result table
numerical columnsglobalSettings
- the global settingsenableHilite
- true
if a row key map should be
maintained to enable hilitingcolNamePolicy
- the ColumnNamePolicy
for the
aggregation columns
input table if set to true
retainOrder
- true
if the original row order should be
retainedCanceledExecutionException
- if the user has canceled the execution@Deprecated protected GroupByTable(ExecutionContext exec, BufferedDataTable inDataTable, List<String> groupByCols, ColumnAggregator[] colAggregators, GlobalSettings globalSettings, boolean sortInMemory, boolean enableHilite, ColumnNamePolicy colNamePolicy, boolean retainOrder) throws CanceledExecutionException
exec
- the ExecutionContext
inDataTable
- the table to aggregategroupByCols
- the name of all columns to group bycolAggregators
- the aggregation columns with the aggregation method
to use in the order the columns should be appear in the result table
numerical columnsglobalSettings
- the global settingssortInMemory
- true
if the table should be sorted in
the memoryenableHilite
- true
if a row key map should be
maintained to enable hilitingcolNamePolicy
- the ColumnNamePolicy
for the
aggregation columns
input table if set to true
retainOrder
- true
if the original row order should be
retainedCanceledExecutionException
- if the user has canceled the executionGroupByTable(ExecutionContext, BufferedDataTable, List,
ColumnAggregator[], GlobalSettings, boolean, ColumnNamePolicy, boolean)
protected abstract BufferedDataTable createGroupByTable(ExecutionContext exec, BufferedDataTable dataTable, DataTableSpec resultSpec, int[] groupColIdx) throws CanceledExecutionException
exec
- the ExecutionContext
dataTable
- the data table to aggregateresultSpec
- the result DataTableSpec
groupColIdx
- the group column indicesCanceledExecutionException
- if the operation has been canceledpublic GlobalSettings getGlobalSettings()
public boolean isEnableHilite()
@Deprecated public boolean isSortInMemory()
false
public boolean isRetainOrder()
public ColumnAggregator[] getColAggregators()
public static BufferedDataTable appendOrderColumn(ExecutionContext exec, BufferedDataTable dataTable, Set<String> workingCols, String retainOrderCol) throws CanceledExecutionException
exec
- the ExecutionContext
dataTable
- the BufferedDataTable
to add the order column toworkingCols
- the names of all columns needed for groupingretainOrderCol
- the name of the order columnCanceledExecutionException
- if the operation has been canceled@Deprecated public static BufferedDataTable sortTable(ExecutionContext exec, BufferedDataTable table2sort, List<String> sortCols, boolean sortInMemory) throws CanceledExecutionException
exec
- ExecutionContext
table2sort
- the BufferedDataTable
to sortsortCols
- the columns to sort bysortInMemory
- the sort in memory flagBufferedDataTable
CanceledExecutionException
- if the operation has been canceledsortTable(ExecutionContext, BufferedDataTable, List)
public static BufferedDataTable sortTable(ExecutionContext exec, BufferedDataTable table2sort, List<String> sortCols) throws CanceledExecutionException
exec
- ExecutionContext
table2sort
- the BufferedDataTable
to sortsortCols
- the columns to sort byBufferedDataTable
CanceledExecutionException
- if the operation has been canceledpublic static String createSkippedGroupName(DataCell[] groupVals)
groupVals
- the group values of the skipped groupprotected void addSkippedGroup(String colName, String skipMsg, DataCell[] groupVals)
colName
- the name of the columnskipMsg
- the skip message to displaygroupVals
- the skipped group valuespublic static final DataTableSpec createGroupByTableSpec(DataTableSpec spec, List<String> groupColNames, ColumnAggregator[] columnAggregators, ColumnNamePolicy colNamePolicy)
spec
- the original DataTableSpec
groupColNames
- the name of all columns to group bycolumnAggregators
- the aggregation columns with the
aggregation method to use in the order the columns should be appear
in the result tablecolNamePolicy
- the ColumnNamePolicy
for the aggregation
columnsDataTableSpec
public Map<RowKey,Set<RowKey>> getHiliteMapping()
Map
or null
if
the enableHilte flag in the constructor was set to false
.
The key of the Map
is the row key of the new group row and
the corresponding value is the Collection
with all old row
keys which belong to this group.Map
or null
if
the enableHilte flag in the constructor was set to false
.public Map<String,Collection<Pair<String,String>>> getSkippedGroupsByColName()
Map
with all skipped groups. The key of the
Map
is the name of the column and the value is a
Collection
with Pair
objects with the
group name as first and the corresponding skip message as second object.Map
with all skipped groupspublic String getSkippedGroupsMessage(int maxGroups, int maxCols)
maxGroups
- the maximum number of skipped groups to displaymaxCols
- the maximum number of columns to display per groupString
message with the skipped groups per column
or null
if no groups where skippedpublic static void checkGroupCols(DataTableSpec spec, List<String> groupCols) throws IllegalArgumentException
spec
- the DataTableSpec
to checkgroupCols
- the group by column name List
IllegalArgumentException
- if one of the group by columns doesn't
exists in the given DataTableSpec
public BufferedDataTable getBufferedTable()
BufferedDataTable
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.