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-6234) Improve Documentation of VariableWidthVector Behavior
Date Wed, 14 Mar 2018 01:00:59 GMT

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

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

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

    https://github.com/apache/drill/pull/1164#discussion_r174327601
  
    --- Diff: exec/vector/src/main/codegen/templates/VariableLengthVectors.java ---
    @@ -514,6 +516,22 @@ public boolean isNull(int index){
        *   The equivalent Java primitive is '${minor.javaType!type.javaType}'
        *
        * NB: this class is automatically generated from ValueVectorTypes.tdd using FreeMarker.
    +   * </p>
    +   * <h2>Contract</h2>
    +   * <p>
    +   *   Variable length vectors do not support random writes. All set methods must be
called for with a monotonically increasing consecutive sequence of indexes.
    +   *   It is possible to trim the vector by setting the value count to be less than the
number of values currently container in the vector with {@link #setValueCount(int)}, then
    +   *   the process of setting values starts with the index after the last index.
    +   * </p>
    +   * <p>
    +   *   It is also possible to back track and set the value at an index earlier than the
current index, however, the caller must assume that all data container after the last
    +   *   set index is corrupted.
    +   * </p>
    +   * <h2>Notes</h2>
    +   * <p>
    +   *   There is no gaurantee the data buffer for the {@link VariableWidthVector} will
have enough space to contain the data you set unless you use setSafe. If you
    +   *   use set you may get array index out of bounds exceptions.
    --- End diff --
    
    Said another way, either 1) be careful to manage your own memory, or 2) call `setSafe()`.
That is, in fact, why `setSafe()` exists.


> Improve Documentation of VariableWidthVector Behavior
> -----------------------------------------------------
>
>                 Key: DRILL-6234
>                 URL: https://issues.apache.org/jira/browse/DRILL-6234
>             Project: Apache Drill
>          Issue Type: Improvement
>            Reporter: Timothy Farkas
>            Assignee: Timothy Farkas
>            Priority: Major
>
> Doing the following will throw an Index out of bounds exception.
> {code}
>       final VarCharVector vector = new VarCharVector(field, allocator);
>       vector.allocateNew();
>       vector.getMutator().setValueCount(100);
> {code}
> The expected behavior is to resize the array appropriately. If an index is uninitialized
you should not call get for that index.
> {code}
> 	at org.apache.drill.exec.memory.BoundsChecking.checkIndex(BoundsChecking.java:80)
> 	at org.apache.drill.exec.memory.BoundsChecking.lengthCheck(BoundsChecking.java:86)
> 	at io.netty.buffer.DrillBuf.chk(DrillBuf.java:114)
> 	at io.netty.buffer.DrillBuf.getInt(DrillBuf.java:484)
> 	at org.apache.drill.exec.vector.UInt4Vector$Accessor.get(UInt4Vector.java:432)
> 	at org.apache.drill.exec.vector.VarCharVector$Mutator.setValueCount(VarCharVector.java:729)
> 	at org.apache.drill.exec.vector.VarCharVectorTest.testExpandingNonEmptyVectorSetValueCount(VarCharVectorTest.java:97)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> 	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
> {code}



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

Mime
View raw message