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 getNextRowSequenceWithLength callsites that close #5653

Merged
Show file tree
Hide file tree
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 @@ -471,7 +471,7 @@ public static void copyData(ChunkSource.WithPrev<? extends Values>[] sources, Ro
}

public static <T extends Values> void fillWithNullValue(ChunkSink<T> dest, RowSequence allKeys) {
final int minSize = Math.min(allKeys.intSize(), COPY_DATA_CHUNK_SIZE);
final int minSize = (int) Math.min(allKeys.size(), COPY_DATA_CHUNK_SIZE);
if (minSize == 0) {
return;
}
Expand All @@ -480,9 +480,8 @@ public static <T extends Values> void fillWithNullValue(ChunkSink<T> dest, RowSe
final RowSequence.Iterator iter = allKeys.getRowSequenceIterator()) {
chunk.fillWithNullValue(0, minSize);
while (iter.hasMore()) {
try (final RowSequence nextKeys = iter.getNextRowSequenceWithLength(COPY_DATA_CHUNK_SIZE)) {
dest.fillFromChunk(destContext, chunk, nextKeys);
}
final RowSequence nextKeys = iter.getNextRowSequenceWithLength(COPY_DATA_CHUNK_SIZE);
dest.fillFromChunk(destContext, chunk, nextKeys);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,38 +172,36 @@ public void onUpdate(TableUpdate upstream) {
}

while (postRsIt.hasMore()) {
try (final RowSequence postChunkOk = postRsIt.getNextRowSequenceWithLength(chunkSize);
final RowSequence preChunkOk =
preRsIt.getNextRowSequenceWithLength(chunkSize)) {
currentSharedContext.reset();
prevSharedContext.reset();
final RowSequence postChunkOk = postRsIt.getNextRowSequenceWithLength(chunkSize);
final RowSequence preChunkOk = preRsIt.getNextRowSequenceWithLength(chunkSize);
currentSharedContext.reset();
prevSharedContext.reset();

for (final int cc : changedColumnIndices) {
// noinspection unchecked
final Chunk<Values> currentValues =
inputSources[cc].getChunk(getContextArray[cc], postChunkOk);
// noinspection unchecked
final Chunk<Values> prevValues =
inputSources[cc].getPrevChunk(prevContextArray[cc], preChunkOk);

// now we need to compare them
equalityKernel[cc].notEqual(currentValues, prevValues, changedCellsArray[cc]);
}

final MutableInt pos = new MutableInt(0);
postChunkOk.forAllRowKeys((idx) -> {
boolean idxChanged = false;
for (final int cc : changedColumnIndices) {
// noinspection unchecked
final Chunk<Values> currentValues =
inputSources[cc].getChunk(getContextArray[cc], postChunkOk);
// noinspection unchecked
final Chunk<Values> prevValues =
inputSources[cc].getPrevChunk(prevContextArray[cc], preChunkOk);

// now we need to compare them
equalityKernel[cc].notEqual(currentValues, prevValues, changedCellsArray[cc]);
}

final MutableInt pos = new MutableInt(0);
postChunkOk.forAllRowKeys((idx) -> {
boolean idxChanged = false;
for (final int cc : changedColumnIndices) {
if (changedCellsArray[cc].get(pos.get())) {
idxChanged = changedColumns[cc] = true;
}
}
if (idxChanged) {
builder.appendKey(idx);
if (changedCellsArray[cc].get(pos.get())) {
idxChanged = changedColumns[cc] = true;
}
pos.increment();
});
}
}
if (idxChanged) {
builder.appendKey(idx);
}
pos.increment();
});
}
}

Expand Down
Loading