drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-6202) Deprecate usage of IndexOutOfBoundsException to re-alloc vectors
Date Wed, 04 Apr 2018 04:25:00 GMT

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

ASF GitHub Bot commented on DRILL-6202:
---------------------------------------

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1144#discussion_r179022533
  
    --- Diff: exec/vector/src/main/codegen/templates/VariableLengthVectors.java ---
    @@ -534,15 +534,11 @@ public void setSafe(int index, byte[] bytes) {
           assert index >= 0;
     
           final int currentOffset = offsetVector.getAccessor().get(index);
    -      offsetVector.getMutator().setSafe(index + 1, currentOffset + bytes.length);
    -      try {
    -        data.setBytes(currentOffset, bytes, 0, bytes.length);
    -      } catch (IndexOutOfBoundsException e) {
    -        while (data.capacity() < currentOffset + bytes.length) {
    -          reAlloc();
    -        }
    -        data.setBytes(currentOffset, bytes, 0, bytes.length);
    +      while (data.capacity() < currentOffset + bytes.length) {
    --- End diff --
    
    One trick used in the row set reader code is to avoid redundant re-allocs by computing
the new size and rounding to a power of two. This is handy at the start with the vector doubles
from 256 to 512 to 1K and the data size is, say, 600 bytes.
    
    However, it is not clear that such an optimization is as necessary as it once was: the
team's been doing a good job at adding up-front vector allocation where it was missing, reducing
the gratuitous reallocs.


> Deprecate usage of IndexOutOfBoundsException to re-alloc vectors
> ----------------------------------------------------------------
>
>                 Key: DRILL-6202
>                 URL: https://issues.apache.org/jira/browse/DRILL-6202
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Vlad Rozov
>            Assignee: Vlad Rozov
>            Priority: Major
>             Fix For: 1.14.0
>
>
> As bounds checking may be enabled or disabled, using IndexOutOfBoundsException to resize
vectors is unreliable. It works only when bounds checking is enabled.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message