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

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_r179022338
  
    --- 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 --
    
    If we compare this implementation to the one from, say, a year or 18 months 
ago, I think we're back where we started.
    
    This would actually be a good use case for a "checkedSetBytes" method that 
does the bounds checks. Still, whether done here or in the underlying method, 
the `if` statement is needed, so no savings in using a "checked" method,


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

Reply via email to