[ https://issues.apache.org/jira/browse/DRILL-6486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16514448#comment-16514448 ]
ASF GitHub Bot commented on DRILL-6486: --------------------------------------- sohami commented on a change in pull request #1316: DRILL-6486: BitVector split and transfer does not work correctly for non byte-multiple transfer lengths URL: https://github.com/apache/drill/pull/1316#discussion_r195873534 ########## File path: exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java ########## @@ -328,7 +328,9 @@ public void splitAndTransferTo(int startIndex, int length, BitVector target) { lastButOneByte = byteIPlus1; bitsFromLastButOneByte = (byte)((lastButOneByte & 0xFF) >>> firstBitOffset); - final int lastByte = this.data.getByte(firstByteIndex + numBytesHoldingSourceBits); + + final int lastByte = (8 - firstBitOffset >= length % 8) ? + 0 : this.data.getByte(firstByteIndex + numBytesHoldingSourceBits); Review comment: Check looks good. Can you please add the motivation of this check in the comment. Based on my understanding `length%8` gives the number of bits to be copied from last byte and `(8-firstBitOffset)` is the bits left to be copied from `lastButOneByte`. So if bits left to be copied is smaller than bits needed from last byte then we need to look at next byte in those cases. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > BitVector split and transfer does not work correctly for non byte-multiple > transfer lengths > ------------------------------------------------------------------------------------------- > > Key: DRILL-6486 > URL: https://issues.apache.org/jira/browse/DRILL-6486 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Data Types > Affects Versions: 1.13.0 > Reporter: Karthikeyan Manivannan > Assignee: Karthikeyan Manivannan > Priority: Major > Fix For: 1.14.0 > > Attachments: TestSplitAndTransfer.java > > Original Estimate: 24h > Remaining Estimate: 24h > > BitVector splitAndTransfer does not correctly handle transfers where the > transfer-length is not a multiple of 8. The attached bitVector tests will > expose this problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)