use of org.knime.core.data.filestore.FileStoreKey in project knime-core by knime.
the class FileStoresInLoopCache method close.
/**
* @throws CanceledExecutionException
*/
BufferedDataTable close() throws CanceledExecutionException {
m_createdFileStoresContainer.close();
BufferedDataTable table = m_createdFileStoresContainer.getTable();
m_createdFileStoresContainer = null;
if (m_keysWereAddedSorted) {
m_createdFileStoresTable = table;
} else {
BufferedDataTableSorter sorter = new BufferedDataTableSorter(table, Collections.singletonList(COL_NAME), new boolean[] { true });
BufferedDataTable sort = sorter.sort(m_exec.createSilentSubExecutionContext(0.0));
BufferedDataContainer unique = m_exec.createDataContainer(LOOP_FILE_STORE_SPEC);
FileStoreKey last = null;
for (DataRow r : sort) {
FileStoreKey key = getFileStoreKey(r);
if (!ConvenienceMethods.areEqual(last, key)) {
unique.addRowToTable(r);
}
last = key;
}
unique.close();
m_exec.clearTable(table);
m_createdFileStoresTable = unique.getTable();
}
return m_createdFileStoresTable;
}
use of org.knime.core.data.filestore.FileStoreKey in project knime-core by knime.
the class FileStoresInLoopCache method next.
private static FileStoreKey next(final RowIterator it, final FileStoreKey previousKey) {
FileStoreKey newKey;
// the table may have duplicates, but they are sorted and therefore consecutive.
do {
DataRow nextRow = it.hasNext() ? it.next() : null;
if (nextRow == null) {
return null;
}
newKey = getFileStoreKey(nextRow);
} while (newKey != null && previousKey != null && newKey.compareTo(previousKey) == 0);
return newKey;
}
Aggregations