public class BufferedDataTableSorter extends AbstractTableSorter
BufferedDataTable
objects. The returned table is also of class
BufferedDataTable
. In comparison to DataTableSorter
this class will take advantage of certain flow
properties when dealing with table objects, for instance it will respect the node's memory policy or better handle
blob objects (which will be referenced in case of BufferedDataTable
but copied for any other type of table).
Usage: Client implementations will initialize this object with the table to be sorted, set properties using the
varies set-methods (defaults are generally fine) and finally call the sort(ExecutionContext)
method.
For details on the sorting mechanism see the package description.
DEF_MAX_OPENCONTAINER, ROWKEY_SORT_SPEC
Constructor and Description |
---|
BufferedDataTableSorter(BufferedDataTable inputTable,
Collection<String> inclList,
boolean[] sortAscending)
Inits table sorter using the sorting according to
AbstractTableSorter.setSortColumns(Collection, boolean[]) . |
BufferedDataTableSorter(BufferedDataTable inputTable,
Collection<String> inclList,
boolean[] sortAscending,
boolean sortMissingsToEnd)
Inits table sorter using the sorting according to
AbstractTableSorter.setSortColumns(Collection, boolean[], boolean) . |
BufferedDataTableSorter(BufferedDataTable inputTable,
Comparator<DataRow> rowComparator)
Inits sorter on argument table with given row comparator.
|
BufferedDataTableSorter(long rowCount,
DataTableSpec dataTableSpec,
Comparator<DataRow> rowComparator,
ExecutionContext ctx)
Package default constructor for the
AbstractColumnTableSorter . |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clearTable(DataTable table)
Clears the temporary table that was used during the execution but is no longer needed.
|
(package private) DataContainer |
createDataContainer(DataTableSpec spec,
boolean forceOnDisk)
Creates data container, either a buffered data container or a plain one.
|
BufferedDataTable |
sort(ExecutionContext ctx)
Sorts the table passed in the constructor according to the settings and returns the sorted output table.
|
addRowToChunk, closeChunk, getMaxOpenContainers, getSortInMemory, mergeChunks, openChunk, setMaxOpenContainers, setMaxRows, setMemService, setRowComparator, setSortColumns, setSortColumns, setSortInMemory, sortInternal
public BufferedDataTableSorter(BufferedDataTable inputTable, Collection<String> inclList, boolean[] sortAscending)
AbstractTableSorter.setSortColumns(Collection, boolean[])
.inputTable
- The table to sortinclList
- Passed on to AbstractTableSorter.setSortColumns(Collection, boolean[])
.sortAscending
- Passed on to AbstractTableSorter.setSortColumns(Collection, boolean[])
.NullPointerException
- If any argument is null.IllegalArgumentException
- If arguments are inconsistent.public BufferedDataTableSorter(BufferedDataTable inputTable, Collection<String> inclList, boolean[] sortAscending, boolean sortMissingsToEnd)
AbstractTableSorter.setSortColumns(Collection, boolean[], boolean)
.inputTable
- The table to sortinclList
- Passed on to AbstractTableSorter.setSortColumns(Collection, boolean[], boolean)
.sortAscending
- Passed on to AbstractTableSorter.setSortColumns(Collection, boolean[], boolean)
.sortMissingsToEnd
- Passed on to AbstractTableSorter.setSortColumns(Collection, boolean[], boolean)
.NullPointerException
- If any argument is null.IllegalArgumentException
- If arguments are inconsistent.public BufferedDataTableSorter(BufferedDataTable inputTable, Comparator<DataRow> rowComparator)
inputTable
- Table to sort.rowComparator
- Passed to AbstractTableSorter.setRowComparator(Comparator)
.BufferedDataTableSorter(long rowCount, DataTableSpec dataTableSpec, Comparator<DataRow> rowComparator, ExecutionContext ctx)
AbstractColumnTableSorter
.rowCount
- the row countdataTableSpec
- the data table specrowComparator
- the row comparatorctx
- for creating the buffered data table instancespublic BufferedDataTable sort(ExecutionContext ctx) throws CanceledExecutionException
ctx
- To report progress & create temporary and final output tables.CanceledExecutionException
- If canceled.DataContainer createDataContainer(DataTableSpec spec, boolean forceOnDisk)
createDataContainer
in class AbstractTableSorter
spec
- The spec of the container/table.forceOnDisk
- false to use default, true to flush data immediately to disk. It's true when used in the
#sortOnDisk(ExecutionMonitor) method and the container is only used temporarily.void clearTable(DataTable table)
clearTable
in class AbstractTableSorter
table
- The table to be cleared.
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.