Hi All:
I was looking following code to release extra allocated buffer. It seems it
should be considering actualCount as "valueCount*typeWidth". Then it should
calculate extra buffer and release it. Right now, it calculates based on
actually allocated size and not justifying the intend. Any thought??
===============================================line 162 at
"https://github.com/apache/arrow/blob/master/java/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java"
protected DataAndValidityBuffers allocFixedDataAndValidityBufs(int valueCount,
int typeWidth) {
long bufferSize = computeCombinedBufferSize(valueCount, typeWidth);
assert bufferSize < MAX_ALLOCATION_SIZE;
int validityBufferSize;
int dataBufferSize;
if (typeWidth == 0) {
validityBufferSize = dataBufferSize = (int) (bufferSize / 2);
} else {
// Due to roundup to power-of-2 allocation, the bufferSize could be greater
than the
// requested size. Utilize the allocated buffer fully.;
int actualCount = (int) ((bufferSize * 8.0) / (8 * typeWidth + 1));
do {
validityBufferSize = (int)
roundUp8(getValidityBufferSizeFromCount(actualCount));
dataBufferSize = (int) roundUp8(actualCount * typeWidth);
if (validityBufferSize + dataBufferSize <= bufferSize) {
break;
}
--actualCount;
} while (true);
}
====================================================
Thanks.Hitesh.