drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-5592) Invalid
Date Sun, 18 Jun 2017 06:06:00 GMT

    [ https://issues.apache.org/jira/browse/DRILL-5592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053079#comment-16053079
] 

Paul Rogers commented on DRILL-5592:
------------------------------------

Title was: BitVector has out-of-date methods from when it was a bit vector

Turns out that the bit vector *is* a bit vector; but nullable vectors now use the {{UInt1Vector}}...

> 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)

Mime
View raw message