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

    https://github.com/apache/carbondata/pull/2657#discussion_r213886769
  
    --- Diff: 
core/src/test/java/org/apache/carbondata/core/util/ByteUtilTest.java ---
    @@ -17,156 +17,246 @@
     package org.apache.carbondata.core.util;
     
     import junit.framework.TestCase;
    +
     import org.apache.carbondata.core.constants.CarbonCommonConstants;
     import org.apache.carbondata.core.util.ByteUtil.UnsafeComparer;
    +
     import org.junit.Before;
     import org.junit.Test;
     
     import java.nio.ByteBuffer;
     import java.nio.charset.Charset;
     
    -
     /**
      * This test will test the functionality of the Byte Util
      * for the comparision of 2 byte buffers
      */
     public class ByteUtilTest extends TestCase {
     
    -    String dimensionValue1 = "aaaaaaaa1235";
    -    String dimensionValue2 = "aaaaaaaa1234";
    -    private ByteBuffer buff1;
    -    private ByteBuffer buff2;
    -
    -    /**
    -     * This method will form one single byte [] for all the high card dims.
    -     *
    -     * @param byteBufferArr
    -     * @return
    -     */
    -    public static byte[] packByteBufferIntoSingleByteArray(
    -            ByteBuffer[] byteBufferArr) {
    -        // for empty array means there is no data to remove dictionary.
    -        if (null == byteBufferArr || byteBufferArr.length == 0) {
    -            return null;
    -        }
    -        int noOfCol = byteBufferArr.length;
    -        short toDetermineLengthOfByteArr = 2;
    -        short offsetLen = (short) (noOfCol * 2 + 
toDetermineLengthOfByteArr);
    -        int totalBytes = calculateTotalBytes(byteBufferArr) + offsetLen;
    -
    -        ByteBuffer buffer = ByteBuffer.allocate(totalBytes);
    -
    -        // write the length of the byte [] as first short
    -        buffer.putShort((short) (totalBytes - toDetermineLengthOfByteArr));
    -        // writing the offset of the first element.
    -        buffer.putShort(offsetLen);
    -
    -        // prepare index for byte []
    -        for (int index = 0; index < byteBufferArr.length - 1; index++) {
    -            ByteBuffer individualCol = byteBufferArr[index];
    -            // short lengthOfbytes = individualCol.getShort();
    -            int noOfBytes = individualCol.capacity();
    -
    -            buffer.putShort((short) (offsetLen + noOfBytes));
    -            offsetLen += noOfBytes;
    -            individualCol.rewind();
    -        }
    -
    -        // put actual data.
    -        for (int index = 0; index < byteBufferArr.length; index++) {
    -            ByteBuffer individualCol = byteBufferArr[index];
    -            buffer.put(individualCol.array());
    -        }
    -
    -        buffer.rewind();
    -        return buffer.array();
    +  String dimensionValue1 = "aaaaaaaa1235";
    +  String dimensionValue2 = "aaaaaaaa1234";
    +  private ByteBuffer buff1;
    +  private ByteBuffer buff2;
     
    +  /**
    +   * This method will form one single byte [] for all the high card dims.
    +   *
    +   * @param byteBufferArr
    +   * @return
    --- End diff --
    
    fixed


---

Reply via email to