You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by jackylk <gi...@git.apache.org> on 2018/08/29 06:55:33 UTC

[GitHub] carbondata pull request #2635: [CARBONDATA-2856][BloomDataMap] Fix bug in bl...

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

    https://github.com/apache/carbondata/pull/2635#discussion_r213563811
  
    --- Diff: datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomDataMapWriter.java ---
    @@ -91,30 +91,28 @@
       @Override
       protected byte[] convertDictionaryValue(int indexColIdx, Object value) {
         // input value from onPageAdded in load process is byte[]
    -    byte[] fakeMdkBytes;
    -    // this means that we need to pad some fake bytes
    -    // to get the whole MDK in corresponding position
    -    if (columnarSplitter.getBlockKeySize().length > indexCol2MdkIdx.size()) {
    -      int totalSize = 0;
    -      for (int size : columnarSplitter.getBlockKeySize()) {
    -        totalSize += size;
    -      }
    -      fakeMdkBytes = new byte[totalSize];
     
    -      // put this bytes to corresponding position
    -      int thisKeyIdx = indexCol2MdkIdx.get(indexColumns.get(indexColIdx).getColName());
    -      int destPos = 0;
    -      for (int keyIdx = 0; keyIdx < columnarSplitter.getBlockKeySize().length; keyIdx++) {
    -        if (thisKeyIdx == keyIdx) {
    -          System.arraycopy(value, 0,
    -              fakeMdkBytes, destPos, columnarSplitter.getBlockKeySize()[thisKeyIdx]);
    -          break;
    -        }
    -        destPos += columnarSplitter.getBlockKeySize()[keyIdx];
    +    // This is used to deal with the multiple global dictionary column as index columns.
    +    // The KeyGenerator works with the whole MDK while the value here only represent part of it,
    +    // so we need to pad fake bytes to it in corresponding position.
    +    int totalSize = 0;
    +    for (int size : columnarSplitter.getBlockKeySize()) {
    +      totalSize += size;
    +    }
    +    byte[] fakeMdkBytes = new byte[totalSize];
    +
    +    // put this bytes to corresponding position
    +    int thisKeyIdx = indexCol2MdkIdx.get(indexColumns.get(indexColIdx).getColName());
    +    int destPos = 0;
    +    for (int keyIdx = 0; keyIdx < columnarSplitter.getBlockKeySize().length; keyIdx++) {
    +      if (thisKeyIdx == keyIdx) {
    +        System.arraycopy(value, 0, fakeMdkBytes, destPos,
    --- End diff --
    
    I am not quite sure about this, please @ravipesala have a look


---