hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nishant Kelkar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-11137) In DateWritable remove the use of LazyBinaryUtils
Date Mon, 29 Jun 2015 17:29:05 GMT

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

Nishant Kelkar commented on HIVE-11137:
---------------------------------------

LazyBinaryUtils used only for readVInt() and writeVInt(). Relevant sections of code from LazyBinaryUtils:

{code}
  private static ThreadLocal<byte[]> vLongBytesThreadLocal = new ThreadLocal<byte[]>()
{
    @Override
    public byte[] initialValue() {
      return new byte[9];
    }
  };

  public static void writeVLong(RandomAccessOutput byteStream, long l) {
    byte[] vLongBytes = vLongBytesThreadLocal.get();
    int len = LazyBinaryUtils.writeVLongToByteArray(vLongBytes, l);
    byteStream.write(vLongBytes, 0, len);
  }
{code}

{code}
  /**
   * Reads a zero-compressed encoded int from a byte array and returns it.
   *
   * @param bytes
   *          the byte array
   * @param offset
   *          offset of the array to read from
   * @param vInt
   *          storing the deserialized int and its size in byte
   */
  public static void readVInt(byte[] bytes, int offset, VInt vInt) {
    byte firstByte = bytes[offset];
    vInt.length = (byte) WritableUtils.decodeVIntSize(firstByte);
    if (vInt.length == 1) {
      vInt.value = firstByte;
      return;
    }
    int i = 0;
    for (int idx = 0; idx < vInt.length - 1; idx++) {
      byte b = bytes[offset + 1 + idx];
      i = i << 8;
      i = i | (b & 0xFF);
    }
    vInt.value = (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1) : i);
  }
{code}

I could contribute a patch towards this task [~owen.omalley] (I'm a beginner contributor in
Hive, looking around for work :)). Thanks and let me know!


> In DateWritable remove the use of LazyBinaryUtils
> -------------------------------------------------
>
>                 Key: HIVE-11137
>                 URL: https://issues.apache.org/jira/browse/HIVE-11137
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Owen O'Malley
>            Assignee: Owen O'Malley
>
> Currently the DateWritable class uses LazyBinaryUtils, which has a lot of dependencies.



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

Mime
View raw message