Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for SelectColumnLayer.prepareSourcesForParallelPopulation with flattenedResult #3806

Merged
merged 1 commit into from
May 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ private void prepareParallelUpdate(final JobScheduler jobScheduler, final TableU
final int numTasks = splitUpdates.size();
final long[] destinationOffsets = new long[numTasks];
if (flattenedResult) {
Assert.assertion(upstream.removed().isEmpty(), "upstream.removed().isEmpty()");
Assert.assertion(upstream.modified().isEmpty(), "upstream.modified().isEmpty()");
Assert.assertion(upstream.shifted().empty(), "upstream.shifted().empty()");
// Note that prepareSourcesForParallelPopulation asserts that upstream has no removes, modifies, or shifts
long destinationOffset = 0;
for (int ti = 0; ti < numTasks; ++ti) {
final TableUpdate splitUpdate = splitUpdates.get(ti);
Expand Down Expand Up @@ -552,13 +550,29 @@ private void doEnsureCapacity() {
}
}

void prepareSourcesForParallelPopulation(TableUpdate upstream) {
// we do not permit in-column parallelization with redirected results, so do not need to worry about how this
// interacts with the previous clearing of the redirection index that has occurred at the start of applyUpdate
try (final WritableRowSet changedRows = upstream.added().union(upstream.getModifiedPreShift())) {
changedRows.insert(upstream.removed());
((WritableSourceWithPrepareForParallelPopulation) (writableSource))
.prepareForParallelPopulation(changedRows);
void prepareSourcesForParallelPopulation(@NotNull final TableUpdate upstream) {
// We do not permit in-column parallelization with redirected results, so do not need to worry about how this
// interacts with the previous clearing of the RowRedirection that has occurred at the start of applyUpdate.
Assert.eqFalse(isRedirected, "isRedirected");

if (flattenedResult) {
// For flattened results the input table must be static; upstream is a "fake" update, and is not permitted
// to have removes, modifies, or shifts.
Assert.assertion(upstream.removed().isEmpty(), "upstream.removed().isEmpty()");
Assert.assertion(upstream.modified().isEmpty(), "upstream.modified().isEmpty()");
Assert.assertion(upstream.shifted().empty(), "upstream.shifted().empty()");
try (final RowSequence flattenedChanges = RowSequenceFactory.forRange(0, upstream.added().size() - 1)) {
((WritableSourceWithPrepareForParallelPopulation) (writableSource))
.prepareForParallelPopulation(flattenedChanges);
}
} else {
// Upstream is not permitted to have shifts for parallel update processing.
Assert.assertion(upstream.shifted().empty(), "upstream.shifted().empty()");
try (final WritableRowSet changedRows = upstream.added().union(upstream.modified())) {
changedRows.insert(upstream.removed());
((WritableSourceWithPrepareForParallelPopulation) (writableSource))
.prepareForParallelPopulation(changedRows);
}
}
}

Expand Down