[ 
https://issues.apache.org/jira/browse/DRILL-5592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Rogers resolved DRILL-5592.
--------------------------------
       Resolution: Invalid
    Fix Version/s:     (was: 1.11.0)

> Invalid
> -------
>
>                 Key: DRILL-5592
>                 URL: https://issues.apache.org/jira/browse/DRILL-5592
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>
> Drill contains a vector class called {{BitVector}} that, apparently, at one 
> time used bits to indicate the set (i.e. not null) state of a nullable 
> vector. At some point in time, the vector because a byte vector (though it 
> retained the original name.)
> It seems some methods were never updated and continue to assume 8 values per 
> byte:
> {code}
>   private int getSizeFromCount(int valueCount) {
>     return (int) Math.ceil(valueCount / 8.0);
>   }
>   @Override
>   public int getValueCapacity() {
>     return (int) Math.min((long)Integer.MAX_VALUE, data.capacity() * 8L);
>   }
>   private int getByteIndex(int index) {
>     return (int) Math.floor(index / 8.0);
>   }
> {code}
> As a result of this old code, certain other methods don't work as expected:
> {code}
>   @Override
>   public void allocateNew(int valueCount) {
>     final int size = getSizeFromCount(valueCount);
>     allocateBytes(size);
>   }
> {code}
> The bug causes the above to allocate room for only 1/8 the values expected. 
> While the mistake is benign, {setSafe}} will have to do three unnecessary 
> doublings to compensate for the error.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to