Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2607#discussion_r207804289
--- Diff:
integration/presto/src/main/scala/org/apache/carbondata/presto/CarbonDictionaryDecodeReadSupport.scala
---
@@ -84,25 +85,31 @@ class CarbonDictionaryDecodeReadSupport[T] extends
CarbonReadSupport[T] {
* @param dictionaryData
* @return
*/
- private def createSliceArrayBlock(dictionaryData: Dictionary):
SliceArrayBlock = {
+ private def createSliceArrayBlock(dictionaryData: Dictionary): Block = {
val chunks: DictionaryChunksWrapper =
dictionaryData.getDictionaryChunks
- val sliceArray = new Array[Slice](chunks.getSize + 1)
- // Initialize Slice Array with Empty Slice as per Presto's code
- sliceArray(0) = Slices.EMPTY_SLICE
- var count = 1
+ val positionCount = chunks.getSize;
+ val offsetVector : Array[Int] = new Array[Int](positionCount + 2 )
+ val isNullVector: Array[Boolean] = new Array[Boolean](positionCount +
1)
+ isNullVector(0) = true
+ isNullVector(1) = true
--- End diff --
We are talking about dictionary here , so In dictionary there will be only
one null and the key value will be 1 by default in CarbonData, hence the
isNullVector will be populated only once with null value it has no bearing on
actual data. The Carbondata key starts from 1 so we need a filler at 0th
position and 1 index is actually Null to map to carbondata null values . The
offset index will be like 0th Position -> 0 (As it is filler)
1st Position -> 0 (For actual Null)
2nd Postion -> 0 as the byte[] is still null so starting point will be 0
only
---