From 4f30c8d4a320f50ef7f4949044ac1ae8e62624a4 Mon Sep 17 00:00:00 2001 From: Chengcheng Jin Date: Tue, 23 Dec 2025 16:32:43 +0800 Subject: [PATCH] [GLUTEN-10933][VL]fix: Fix the CudfVector childreSize is not correct --- cpp/velox/memory/VeloxColumnarBatch.h | 7 +++++++ cpp/velox/utils/GpuBufferBatchResizer.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cpp/velox/memory/VeloxColumnarBatch.h b/cpp/velox/memory/VeloxColumnarBatch.h index cecadd3cdfdb..4b83d302a09f 100644 --- a/cpp/velox/memory/VeloxColumnarBatch.h +++ b/cpp/velox/memory/VeloxColumnarBatch.h @@ -29,6 +29,13 @@ class VeloxColumnarBatch final : public ColumnarBatch { VeloxColumnarBatch(facebook::velox::RowVectorPtr rowVector) : ColumnarBatch(rowVector->childrenSize(), rowVector->size()), rowVector_(rowVector) {} +#ifdef GLUTEN_ENABLE_GPU + // The batch may be CudfVector, it's childrenSize is not correct, many tests failed if correcting the value + // https://github.com/facebookincubator/velox/pull/15629#discussion_r2581655771 + VeloxColumnarBatch(facebook::velox::RowVectorPtr rowVector, int32_t numColumns) + : ColumnarBatch(numColumns, rowVector->size()), rowVector_(rowVector) {} +#endif + std::string getType() const override { return kType; } diff --git a/cpp/velox/utils/GpuBufferBatchResizer.cc b/cpp/velox/utils/GpuBufferBatchResizer.cc index ad98fd47017d..518f280fc3eb 100644 --- a/cpp/velox/utils/GpuBufferBatchResizer.cc +++ b/cpp/velox/utils/GpuBufferBatchResizer.cc @@ -159,7 +159,7 @@ std::shared_ptr makeCudfTable( auto cudfTable = std::make_unique(std::move(cudfColumns)); stream.synchronize(); return std::make_shared( - std::make_shared(pool, type, numRows, std::move(cudfTable), stream)); + std::make_shared(pool, type, numRows, std::move(cudfTable), stream), type->size()); } } // namespace