Copilot commented on code in PR #12499:
URL: https://github.com/apache/gluten/pull/12499#discussion_r3559907900
##########
cpp/velox/tests/VeloxGpuShuffleWriterTest.cc:
##########
@@ -21,7 +21,6 @@
#include "config/GlutenConfig.h"
#include "memory/GpuBufferColumnarBatch.h"
#include "shuffle/VeloxGpuShuffleWriter.h"
Review Comment:
This test still includes `shuffle/VeloxGpuShuffleWriter.h`, but that header
is deleted in this PR (VeloxGpuShuffleWriter.{h,cc} removed), so the test won’t
compile. Replace the include with the generic `VeloxShuffleWriter` header (it
also brings in `HashShuffleWriterOptions` via `shuffle/Options.h`).
##########
cpp/velox/memory/GpuBufferColumnarBatch.cc:
##########
@@ -147,28 +161,46 @@ std::shared_ptr<GpuBufferColumnarBatch>
GpuBufferColumnarBatch::compose(
arrow::internal::CopyBitmap(batch->bufferAt(bufferIdx)->data(), 0,
batch->numRows(), dst, rowNumber);
}
- if (colType->isFixedWidth()) {
+ if (colType->isTimestamp()) {
+ const auto bufferSize = batch->bufferAt(bufferIdx + 1)->size() >> 1;
+ VELOX_CHECK_LE(valueBufferOffset + bufferSize, returnBuffers[bufferIdx
+ 1]->size());
+ const auto* src = reinterpret_cast<const
int64_t*>(batch->bufferAt(bufferIdx + 1)->data());
+ auto* dst = reinterpret_cast<int64_t*>(returnBuffers[bufferIdx +
1]->mutable_data());
+ for (auto j = 0; j < batch->numRows(); ++j) {
+ dst[valueBufferOffset + j] = src[j << 1] * 1'000'000'000L + src[j <<
1 | 1];
+ }
+ valueBufferOffset += bufferSize;
Review Comment:
In the timestamp path, `valueBufferOffset` is tracked in bytes (as in the
fixed-width and string branches), but it’s used as an `int64_t` element index
(`dst[valueBufferOffset + j]`). This will write out of bounds and corrupt the
output buffer. Use a byte-based destination pointer and write `int64_t` values
at the correct offset.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]