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

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

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

    https://github.com/apache/drill/pull/283#discussion_r46347779
  
    --- Diff: 
exec/memory/base/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java ---
    @@ -89,156 +131,139 @@ public ByteBuf order(ByteOrder endianness) {
       }
     
       @Override
    -    public double getDouble(int index) {
    -        return Double.longBitsToDouble(getLong(index));
    -    }
    -
    -    @Override
    -    public char getChar(int index) {
    -        return (char) getShort(index);
    -    }
    -
    -    @Override
    -    public long getUnsignedInt(int index) {
    -        return getInt(index) & 0xFFFFFFFFL;
    -    }
    +  public double getDouble(int index) {
    +    return Double.longBitsToDouble(getLong(index));
    +  }
     
    -    @Override
    -    public int getInt(int index) {
    -//        wrapped.checkIndex(index, 4);
    -        int v = PlatformDependent.getInt(addr(index));
    -        return v;
    -    }
    +  @Override
    +  public char getChar(int index) {
    +    return (char) getShort(index);
    +  }
     
    -    @Override
    -    public int getUnsignedShort(int index) {
    -        return getShort(index) & 0xFFFF;
    -    }
    +  @Override
    +  public long getUnsignedInt(int index) {
    +    return getInt(index) & 0xFFFFFFFFL;
    +  }
     
    -    @Override
    -    public short getShort(int index) {
    -//        wrapped.checkIndex(index, 2);
    -        short v = PlatformDependent.getShort(addr(index));
    -        return v;
    -    }
    +  @Override
    +  public int getInt(int index) {
    +    int v = PlatformDependent.getInt(addr(index));
    +    return v;
    +  }
     
    -    @Override
    -    public ByteBuf setShort(int index, int value) {
    -        wrapped.checkIndex(index, 2);
    -        _setShort(index, value);
    -        return this;
    -    }
    +  @Override
    +  public int getUnsignedShort(int index) {
    +    return getShort(index) & 0xFFFF;
    +  }
     
    -    @Override
    -    public ByteBuf setInt(int index, int value) {
    -        wrapped.checkIndex(index, 4);
    -        _setInt(index, value);
    -        return this;
    -    }
    +  @Override
    +  public short getShort(int index) {
    +    short v = PlatformDependent.getShort(addr(index));
    +    return v;
    +  }
     
    -    @Override
    -    public ByteBuf setLong(int index, long value) {
    -        wrapped.checkIndex(index, 8);
    -        _setLong(index, value);
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setShort(int index, int value) {
    +    wrapped.checkIndex(index, 2);
    +    _setShort(index, value);
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf setChar(int index, int value) {
    -        setShort(index, value);
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setInt(int index, int value) {
    +    wrapped.checkIndex(index, 4);
    +    _setInt(index, value);
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf setFloat(int index, float value) {
    -        setInt(index, Float.floatToRawIntBits(value));
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setLong(int index, long value) {
    +    wrapped.checkIndex(index, 8);
    +    _setLong(index, value);
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf setDouble(int index, double value) {
    -        setLong(index, Double.doubleToRawLongBits(value));
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setChar(int index, int value) {
    +    setShort(index, value);
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeShort(int value) {
    -        wrapped.ensureWritable(2);
    -        _setShort(wrapped.writerIndex, value);
    -        wrapped.writerIndex += 2;
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setFloat(int index, float value) {
    +    setInt(index, Float.floatToRawIntBits(value));
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeInt(int value) {
    -        wrapped.ensureWritable(4);
    -        _setInt(wrapped.writerIndex, value);
    -        wrapped.writerIndex += 4;
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf setDouble(int index, double value) {
    +    setLong(index, Double.doubleToRawLongBits(value));
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeLong(long value) {
    -        wrapped.ensureWritable(8);
    -        _setLong(wrapped.writerIndex, value);
    -        wrapped.writerIndex += 8;
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf writeShort(int value) {
    +    wrapped.ensureWritable(2);
    +    _setShort(wrapped.writerIndex, value);
    +    wrapped.writerIndex += 2;
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeChar(int value) {
    -        writeShort(value);
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf writeInt(int value) {
    +    wrapped.ensureWritable(4);
    +    _setInt(wrapped.writerIndex, value);
    +    wrapped.writerIndex += 4;
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeFloat(float value) {
    -        writeInt(Float.floatToRawIntBits(value));
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf writeLong(long value) {
    +    wrapped.ensureWritable(8);
    +    _setLong(wrapped.writerIndex, value);
    +    wrapped.writerIndex += 8;
    +    return this;
    +  }
     
    -    @Override
    -    public ByteBuf writeDouble(double value) {
    -        writeLong(Double.doubleToRawLongBits(value));
    -        return this;
    -    }
    +  @Override
    +  public ByteBuf writeChar(int value) {
    +    writeShort(value);
    +    return this;
    +  }
     
    -    private void _setShort(int index, int value) {
    -        PlatformDependent.putShort(addr(index), (short) value);
    -    }
    +  @Override
    +  public ByteBuf writeFloat(float value) {
    +    writeInt(Float.floatToRawIntBits(value));
    +    return this;
    +  }
     
    -    private void _setInt(int index, int value) {
    -        PlatformDependent.putInt(addr(index), value);
    -    }
    +  @Override
    +  public ByteBuf writeDouble(double value) {
    +    writeLong(Double.doubleToRawLongBits(value));
    +    return this;
    +  }
     
    -    private void _setLong(int index, long value) {
    -        PlatformDependent.putLong(addr(index), value);
    -    }
    +  private void _setShort(int index, int value) {
    +    PlatformDependent.putShort(addr(index), (short) value);
    +  }
     
    -    @Override
    -    public byte getByte(int index) {
    -      return PlatformDependent.getByte(addr(index));
    -    }
    +  private void _setInt(int index, int value) {
    +    PlatformDependent.putInt(addr(index), value);
    +  }
     
    -    @Override
    -    public ByteBuf setByte(int index, int value) {
    -      PlatformDependent.putByte(addr(index), (byte) value);
    -      return this;
    -    }
    +  private void _setLong(int index, long value) {
    +    PlatformDependent.putLong(addr(index), value);
    +  }
     
       @Override
    -  public boolean release() {
    -    return release(1);
    +  public byte getByte(int index) {
    +    return PlatformDependent.getByte(addr(index));
       }
     
       @Override
    -  public boolean release(int decrement) {
    --- End diff --
    
    this is the only place where `bufferCount`, `bufferSize` and `initCap` 
where used. Should we remove them from UDLE ? if yes, we should also remove the 
corresponding counters from `PooledByteBufAllocatorL`


> Incorporate remaining patches from DRILL-1942 Allocator refactor
> ----------------------------------------------------------------
>
>                 Key: DRILL-4134
>                 URL: https://issues.apache.org/jira/browse/DRILL-4134
>             Project: Apache Drill
>          Issue Type: Sub-task
>          Components: Execution - Flow
>            Reporter: Jacques Nadeau
>            Assignee: Jacques Nadeau
>             Fix For: 1.4.0
>
>




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

Reply via email to