io.deephaven.engine.table.impl.replay.ReplayGroupedFullTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-table Show documentation
Show all versions of deephaven-engine-table Show documentation
Engine Table: Implementation and closely-coupled utilities
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.engine.table.impl.replay;
import io.deephaven.engine.rowset.RowSet;
import io.deephaven.engine.rowset.RowSetBuilderRandom;
import io.deephaven.engine.rowset.RowSetFactory;
import io.deephaven.engine.rowset.TrackingRowSet;
import io.deephaven.engine.table.ColumnSource;
import io.deephaven.engine.table.impl.util.*;
import io.deephaven.time.DateTimeUtils;
import java.util.Map;
public class ReplayGroupedFullTable extends QueryReplayGroupedTable {
private int redirIndexSize;
public ReplayGroupedFullTable(TrackingRowSet rowSet, Map> input,
String timeColumn,
Replayer replayer, String groupingColumn) {
super("ReplayGroupedFullTable", rowSet, input, timeColumn, replayer,
WritableRowRedirection.FACTORY.createRowRedirection((int) rowSet.size()),
new String[] {groupingColumn});
redirIndexSize = 0;
// We do not modify existing entries in the WritableRowRedirection (we only add at the end), so there's no need
// to ask the WritableRowRedirection to track previous values.
}
@Override
public void run() {
if (allIterators.isEmpty()) {
return;
}
RowSetBuilderRandom rowSetBuilder = RowSetFactory.builderRandom();
while (!allIterators.isEmpty()
&& DateTimeUtils.epochNanos(allIterators.peek().lastTime) < replayer.clock().currentTimeNanos()) {
IteratorsAndNextTime currentIt = allIterators.poll();
final long key = redirIndexSize++;
rowRedirection.put(key, currentIt.lastIndex);
rowSetBuilder.addKey(key);
currentIt = currentIt.next();
if (currentIt != null) {
allIterators.add(currentIt);
}
}
final RowSet added = rowSetBuilder.build();
if (!added.isEmpty()) {
getRowSet().writableCast().insert(added);
notifyListeners(added, RowSetFactory.empty(), RowSetFactory.empty());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy