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

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

Github user jaltekruse commented on a diff in the pull request:

    https://github.com/apache/drill/pull/81#discussion_r35809948
  
    --- Diff: exec/java-exec/src/main/codegen/templates/FixedValueVectors.java 
---
    @@ -156,21 +156,17 @@ public void zeroVector() {
       }
     
       @Override
    -  public int load(int valueCount, DrillBuf buf){
    +  public void load(SerializedField metadata, DrillBuf buffer) {
    +    final int actualLength = metadata.getBufferLength();
    +    final int valueCount = metadata.getValueCount();
    +    final int expectedLength = valueCount * ${type.width};
    +    assert actualLength == expectedLength : String.format("Expected to 
load %d bytes but actually loaded %d bytes", expectedLength, actualLength);
    +
         clear();
    -    int len = valueCount * ${type.width};
    -    data = buf.slice(0, len);
    +    data = buffer.slice(0, actualLength);
    +    data.writerIndex(actualLength);
         data.retain();
    -    data.writerIndex(len);
    -    return len;
    -  }
    -
    -  @Override
    -  public void load(SerializedField metadata, DrillBuf buffer) {
    -    assert this.field.matches(metadata) : String.format("The field %s 
doesn't match the provided metadata %s.", this.field, metadata);
    --- End diff --
    
    Are you sure we want to actually remove this assert, are we certain that it 
is no longer useful for catching inconsistent state problems?


> Eliminate redundant #load methods and unit-test loading & exporting of vectors
> ------------------------------------------------------------------------------
>
>                 Key: DRILL-3313
>                 URL: https://issues.apache.org/jira/browse/DRILL-3313
>             Project: Apache Drill
>          Issue Type: Sub-task
>          Components: Execution - Data Types
>    Affects Versions: 1.0.0
>            Reporter: Hanifi Gunes
>            Assignee: Jason Altekruse
>             Fix For: 1.2.0
>
>
> Vectors have multiple #load methods that are used to populate data from raw 
> buffers. It is relatively tough to reason, maintain and unit-test loading and 
> exporting of data since there is many redundant code around load methods. 
> This issue proposes to have single #load method conforming to VV#load(def, 
> buffer) signature eliminating all other #load overrides.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to