myegorov commented on code in PR #44627:
URL: https://github.com/apache/arrow/pull/44627#discussion_r1827159337
##########
java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java:
##########
@@ -211,23 +211,25 @@ public void splitAndTransfer(int startIndex, int length) {
startIndex,
length,
valueCount);
- final int startPoint = offsetBuffer.getInt(startIndex * OFFSET_WIDTH);
- final int sliceLength =
- offsetBuffer.getInt((startIndex + length) * OFFSET_WIDTH) -
startPoint;
to.clear();
- to.offsetBuffer = to.allocateOffsetBuffer((length + 1) * OFFSET_WIDTH);
- /* splitAndTransfer offset buffer */
- for (int i = 0; i < length + 1; i++) {
- final int relativeOffset =
- offsetBuffer.getInt((startIndex + i) * OFFSET_WIDTH) - startPoint;
- to.offsetBuffer.setInt(i * OFFSET_WIDTH, relativeOffset);
+ if (length > 0) {
Review Comment:
Can do though my personal preference would be to avoid multiple returns.
Current implementation is in keeping with how `splitAndTransfer` is implemented
for other complex types (e.g. ListVector).
--
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]