WeichenXu123 commented on pull request #9187: URL: https://github.com/apache/arrow/pull/9187#issuecomment-763621581
@liyafan82 But, I don't agree. See this section comment in source code: https://github.com/apache/arrow/blob/691286975f277f00586cabc6d834ff1efd8caf8c/java/vector/src/main/java/org/apache/arrow/vector/ValueVector.java#L163 ``` /** * Returns the number of bytes that is used by this vector if it holds the given number * of values. The result will be the same as if setValueCount() were called, followed * by calling getBufferSize(), but without any of the closing side-effects that setValueCount() * implies wrt finishing off the population of a vector. Some operations might wish to use * this to determine how much memory has been used by a vector so far, even though it is * not finished being populated. * * @param valueCount the number of values to assume this vector contains * @return the buffer size if this vector is holding valueCount values */ int getBufferSizeFor(int valueCount); ``` The `getBufferSizeFor` is designed for the case: when `setValueCount` haven't been called. It also definitely say `setValueCount()` will bring "closing side-effects" (implies wrt finishing off the population of a vector) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
