jinchengchenghh commented on code in PR #9350:
URL: https://github.com/apache/incubator-gluten/pull/9350#discussion_r2048540098


##########
backends-velox/src/main/scala/org/apache/gluten/execution/RowToVeloxColumnarExec.scala:
##########
@@ -168,35 +165,28 @@ object RowToVeloxColumnarExec {
         val rowLength = new ListBuffer[Long]()
         var rowCount = 0
         var offset = 0L
-        val sizeInBytes = row.getSizeInBytes
-        // allocate buffer based on 1st row, but if first row is very big, 
this will cause OOM
-        // maybe we should optimize to list ArrayBuf to native to avoid buf 
close and allocate
-        // 31760L origins from 
BaseVariableWidthVector.lastValueAllocationSizeInBytes
-        // experimental value
-        val estimatedBufSize = Math.max(
-          Math.min(sizeInBytes.toDouble * columnBatchSize * 1.2, 31760L * 
columnBatchSize),
-          sizeInBytes.toDouble * 10)
-        arrowBuf = arrowAllocator.buffer(estimatedBufSize.toLong)
-        Platform.copyMemory(
-          row.getBaseObject,
-          row.getBaseOffset,
-          null,
-          arrowBuf.memoryAddress() + offset,
-          sizeInBytes)
-        offset += sizeInBytes
-        rowLength += sizeInBytes.toLong
-        rowCount += 1
-
-        convertTime += System.currentTimeMillis() - start
         while (rowCount < columnBatchSize && !finished) {
-          val iterHasNext = it.hasNext
-          if (!iterHasNext) {
+          // The first row does not need to call it.hasNext, otherwise metrics 
will be updated repeatedly.
+          if (rowCount != 0 && !it.hasNext) {

Review Comment:
   hasNext should allow to call twice, what problem do you meet?



-- 
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]

Reply via email to