Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2978#discussion_r240558250
--- Diff:
integration/presto/src/main/java/org/apache/carbondata/presto/ColumnarVectorWrapperDirect.java
---
@@ -0,0 +1,320 @@
+/*
+ * 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.presto;
+
+import java.math.BigDecimal;
+import java.util.BitSet;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.result.vector.CarbonColumnVector;
+import org.apache.carbondata.core.scan.result.vector.CarbonDictionary;
+import
org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl;
+import
org.apache.carbondata.core.scan.result.vector.impl.directread.SequentialFill;
+import org.apache.carbondata.core.scan.scanner.LazyPageLoader;
+
+/**
+ * Fills the vector directly with out considering any deleted rows.
+ */
+class ColumnarVectorWrapperDirect implements
CarbonColumnVector,SequentialFill {
+
+
+ /**
+ * It is adapter class of complete ColumnarBatch.
+ */
+ protected CarbonColumnVectorImpl columnVector;
+
+ private DataType blockDataType;
+
+ private CarbonColumnVector dictionaryVector;
+
+ private BitSet nullBitset;
+
+ ColumnarVectorWrapperDirect(CarbonColumnVectorImpl columnVector) {
+ this.columnVector = columnVector;
+ this.dictionaryVector = columnVector.getDictionaryVector();
+ this.nullBitset = new BitSet();
+ }
+
+ @Override public void setNullBits(BitSet nullBits) {
+ this.nullBitset = nullBits;
+ }
+
+ @Override public void putBoolean(int rowId, boolean value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putBoolean(rowId, value);
+ }
+ }
+
+ @Override public void putFloat(int rowId, float value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putFloat(rowId, value);
+ }
+ }
+
+ @Override public void putShort(int rowId, short value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putShort(rowId, value);
+ }
+ }
+
+ @Override public void putShorts(int rowId, int count, short value) {
+ for (int i = 0; i < count; i++) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putShort(rowId, value);
+ }
+ rowId++;
+ }
+
+ }
+
+ @Override public void putInt(int rowId, int value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putInt(rowId, value);
+ }
+ }
+
+ @Override public void putInts(int rowId, int count, int value) {
+ columnVector.putInts(rowId, count, value);
+ }
+
+ @Override public void putLong(int rowId, long value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putLong(rowId, value);
+ }
+ }
+
+ @Override public void putLongs(int rowId, int count, long value) {
+ columnVector.putLongs(rowId, count, value);
+ }
+
+ @Override public void putDecimal(int rowId, BigDecimal value, int
precision) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putDecimal(rowId, value, precision);
+ }
+ }
+
+ @Override public void putDecimals(int rowId, int count, BigDecimal
value, int precision) {
+ for (int i = 0; i < count; i++) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putDecimal(rowId, value, precision);
+ }
+ rowId++;
+ }
+ }
+
+ @Override public void putDouble(int rowId, double value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putDouble(rowId, value);
+ }
+ }
+
+ @Override public void putDoubles(int rowId, int count, double value) {
+ columnVector.putDoubles(rowId, count, value);
+ }
+
+ @Override public void putByteArray(int rowId, byte[] value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putByteArray(rowId, value);
+ }
+ }
+
+ @Override
+ public void putBytes(int rowId, int count, byte[] value) {
+ for (int i = 0; i < count; i++) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putByteArray(rowId, value);
+ }
+ rowId++;
+ }
+ }
+
+ @Override public void putByteArray(int rowId, int offset, int length,
byte[] value) {
+ if (nullBitset.get(rowId)) {
+ columnVector.putNull(rowId);
+ } else {
+ columnVector.putByteArray(rowId, offset, length, value);
+ }
+ }
+
+ @Override public void putNull(int rowId) {
+ columnVector.putNull(rowId);
+ }
+
+ @Override public void putNulls(int rowId, int count) {
+ columnVector.putNulls(rowId, count);
+ }
+
+ @Override public void putNotNull(int rowId) {
+ columnVector.putNotNull(rowId);
+ }
+
+ @Override public void putNotNull(int rowId, int count) {
+ }
+
+ @Override public boolean isNull(int rowId) {
+ return columnVector.isNullAt(rowId);
+ }
+
+ @Override public void putObject(int rowId, Object obj) {
+ //TODO handle complex types
--- End diff --
ok
---