From e0eed886ab2a0dc6fc9370570baaa35e827ef554 Mon Sep 17 00:00:00 2001 From: "wangxinshuo.db" Date: Thu, 20 Jun 2024 11:44:52 +0800 Subject: [PATCH] fix --- .../serializer/VeloxColumnarToRowConverter.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cpp/velox/operators/serializer/VeloxColumnarToRowConverter.cc b/cpp/velox/operators/serializer/VeloxColumnarToRowConverter.cc index 63339c067e606..f8c06c37dd473 100644 --- a/cpp/velox/operators/serializer/VeloxColumnarToRowConverter.cc +++ b/cpp/velox/operators/serializer/VeloxColumnarToRowConverter.cc @@ -39,10 +39,11 @@ void VeloxColumnarToRowConverter::refreshStates( size_t totalMemorySize = 0; if (auto fixedRowSize = velox::row::UnsafeRowFast::fixedRowSize(velox::asRowType(rowVector->type()))) { - GLUTEN_CHECK( - memoryThreshold > fixedRowSize.value(), - "spark.gluten.sql.columnarToRowMemoryThreshold(" + velox::succinctBytes(memoryThreshold) + - ") is too small, it can't hold even one row(" + velox::succinctBytes(fixedRowSize.value()) + ")"); + if (memoryThreshold < fixedRowSize.value()) { + memoryThreshold = fixedRowSize.value(); + LOG(ERROR) << "spark.gluten.sql.columnarToRowMemoryThreshold(" + velox::succinctBytes(memoryThreshold) + + ") is too small, it can't hold even one row(" + velox::succinctBytes(fixedRowSize.value()) + ")"; + } auto rowSize = fixedRowSize.value(); numRows_ = std::min(memoryThreshold / rowSize, vectorLength - rowId); totalMemorySize = rowSize * numRows_; @@ -51,10 +52,11 @@ void VeloxColumnarToRowConverter::refreshStates( for (; i < vectorLength; ++i) { auto rowSize = fast_->rowSize(i); if (UNLIKELY(totalMemorySize + rowSize > memoryThreshold)) { - GLUTEN_CHECK( - i >= 1, - "spark.gluten.sql.columnarToRowMemoryThreshold(" + velox::succinctBytes(memoryThreshold) + - ") is too small, it can't hold even one row(" + velox::succinctBytes(rowSize) + ")"); + if (i == rowId) { + memoryThreshold = rowSize; + LOG(ERROR) << "spark.gluten.sql.columnarToRowMemoryThreshold(" + velox::succinctBytes(memoryThreshold) + + ") is too small, it can't hold even one row(" + velox::succinctBytes(rowSize) + ")"; + } break; } else { totalMemorySize += rowSize;