Github user manishgupta88 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2822#discussion_r226980856 --- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/vector/impl/directread/ColumnarVectorWrapperDirectWithDeleteDeltaAndInvertedIndex.java --- @@ -0,0 +1,258 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.carbondata.core.scan.result.vector.impl.directread; + +import java.math.BigDecimal; +import java.util.BitSet; + +import org.apache.carbondata.core.metadata.datatype.DataType; +import org.apache.carbondata.core.metadata.datatype.DataTypes; +import org.apache.carbondata.core.metadata.datatype.DecimalType; +import org.apache.carbondata.core.scan.result.vector.CarbonColumnVector; +import org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl; + +/** + * Column vector for column pages which has delete delta and inverted index, so it uses delta biset + * to filter out data and use inverted index before filling to actual vector + */ +class ColumnarVectorWrapperDirectWithDeleteDeltaAndInvertedIndex + extends AbstractCarbonColumnarVector implements ConvertableVector { + + private BitSet deletedRows; + + private int[] invertedIndex; + + private CarbonColumnVectorImpl carbonColumnVector; + + private CarbonColumnVector columnVector; + + private int precision; + + private BitSet nullBits; + + private boolean isnullBitsExists; + + public ColumnarVectorWrapperDirectWithDeleteDeltaAndInvertedIndex( + CarbonColumnVector vectorWrapper, BitSet deletedRows, int[] invertedIndex, BitSet nullBits, + boolean isnullBitsExists) { + this.deletedRows = deletedRows; + this.invertedIndex = invertedIndex; + carbonColumnVector = new CarbonColumnVectorImpl(invertedIndex.length, vectorWrapper.getType()); + this.columnVector = vectorWrapper; + this.nullBits = nullBits; + this.isnullBitsExists = isnullBitsExists; + } + + @Override + public void putBoolean(int rowId, boolean value) { + carbonColumnVector.putBoolean(invertedIndex[rowId], value); + } + + @Override + public void putFloat(int rowId, float value) { + carbonColumnVector.putFloat(invertedIndex[rowId], value); + } + + @Override + public void putShort(int rowId, short value) { + carbonColumnVector.putShort(invertedIndex[rowId], value); + } + + @Override + public void putInt(int rowId, int value) { + carbonColumnVector.putInt(invertedIndex[rowId], value); + } + + @Override + public void putLong(int rowId, long value) { + carbonColumnVector.putLong(invertedIndex[rowId], value); + } + + @Override + public void putDecimal(int rowId, BigDecimal value, int precision) { + this.precision = precision; + carbonColumnVector.putDecimal(invertedIndex[rowId], value, precision); + } + + @Override + public void putDouble(int rowId, double value) { + carbonColumnVector.putDouble(invertedIndex[rowId], value); + } + + @Override + public void putByteArray(int rowId, byte[] value) { + carbonColumnVector.putByteArray(invertedIndex[rowId], value); + } + + @Override + public void putByteArray(int rowId, int offset, int length, byte[] value) { + carbonColumnVector.putByteArray(invertedIndex[rowId], offset, length, value); + } + + @Override + public void putByte(int rowId, byte value) { + carbonColumnVector.putByte(invertedIndex[rowId], value); + } + + @Override + public void putNull(int rowId) { + if (isnullBitsExists) { + nullBits.set(rowId); + } else { + nullBits.set(invertedIndex[rowId]); --- End diff -- please add a comment to explain this if-else logic...flag `isnullBitsExists` is to distinguish between measure and dimension. When the flag is true that means it is a measure and for measures we do not have inverted index while the else case is for dimensions for which inverted index exists. Is my understanding correct?
---