akkio-97 commented on a change in pull request #3773:
URL: https://github.com/apache/carbondata/pull/3773#discussion_r467639051
##########
File path:
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
##########
@@ -246,7 +239,29 @@ public void decodeAndFillVector(byte[] pageData,
ColumnVectorInfo vectorInfo, Bi
vector = ColumnarVectorWrapperDirectFactory
.getDirectVectorWrapperFactory(vector, vectorInfo.invertedIndex,
nullBits, deletedRows,
true, false);
- fillVector(pageData, vector, vectorDataType, pageDataType, pageSize,
vectorInfo, nullBits);
+ Deque<CarbonColumnVectorImpl> vectorStack = vectorInfo.getVectorStack();
+ // Only if vectorStack is null, it is initialized with the parent vector
+ if (vectorStack == null && vectorInfo.vector.getColumnVector() != null) {
+ vectorStack = new ArrayDeque<>();
+ // pushing the parent vector
+ vectorStack.push((CarbonColumnVectorImpl)
vectorInfo.vector.getColumnVector());
+ vectorInfo.setVectorStack(vectorStack);
+ }
+ /*
+ * if top of vector stack is a complex vector then
+ * add their children into the stack and load them too.
+ * TODO: If there are multiple children push them into stack and load
them iteratively
+ */
+ if (vectorStack != null && vectorStack.peek().isComplex()) {
+ vectorStack.peek().setChildrenElements(pageData);
Review comment:
done
##########
File path:
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
##########
@@ -246,7 +239,29 @@ public void decodeAndFillVector(byte[] pageData,
ColumnVectorInfo vectorInfo, Bi
vector = ColumnarVectorWrapperDirectFactory
.getDirectVectorWrapperFactory(vector, vectorInfo.invertedIndex,
nullBits, deletedRows,
true, false);
- fillVector(pageData, vector, vectorDataType, pageDataType, pageSize,
vectorInfo, nullBits);
+ Deque<CarbonColumnVectorImpl> vectorStack = vectorInfo.getVectorStack();
+ // Only if vectorStack is null, it is initialized with the parent vector
+ if (vectorStack == null && vectorInfo.vector.getColumnVector() != null) {
+ vectorStack = new ArrayDeque<>();
+ // pushing the parent vector
+ vectorStack.push((CarbonColumnVectorImpl)
vectorInfo.vector.getColumnVector());
+ vectorInfo.setVectorStack(vectorStack);
+ }
+ /*
+ * if top of vector stack is a complex vector then
+ * add their children into the stack and load them too.
+ * TODO: If there are multiple children push them into stack and load
them iteratively
+ */
+ if (vectorStack != null && vectorStack.peek().isComplex()) {
+ vectorStack.peek().setChildrenElements(pageData);
+ vectorStack.push(vectorStack.peek().getChildrenVector().get(0));
+ vectorStack.peek().loadPage();
+ return;
+ }
+
+ FillVector fill = new FillVector(pageData, vectorInfo, nullBits);
+ fill.basedOnType(vector, vectorDataType, pageSize, pageDataType);
+
Review comment:
done
##########
File path:
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/FillVector.java
##########
@@ -0,0 +1,346 @@
+/*
+ * 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.datastore.page.encoding;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+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.DecimalConverterFactory;
+import org.apache.carbondata.core.scan.result.vector.CarbonColumnVector;
+import org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo;
+import
org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl;
+import org.apache.carbondata.core.util.ByteUtil;
+
+public class FillVector {
+ private byte[] pageData;
+ private float floatFactor = 0;
+ private double factor = 0;
+ private ColumnVectorInfo vectorInfo;
+ private BitSet nullBits;
+
+ public FillVector(byte[] pageData, ColumnVectorInfo vectorInfo, BitSet
nullBits) {
+ this.pageData = pageData;
+ this.vectorInfo = vectorInfo;
+ this.nullBits = nullBits;
+ }
+
+ public void setFactor(double factor) {
+ this.factor = factor;
+ }
+
+ public void setFloatFactor(float floatFactor) {
+ this.floatFactor = floatFactor;
+ }
+
+ public void basedOnType(CarbonColumnVector vector, DataType vectorDataType,
int pageSize,
+ DataType pageDataType) {
+ if (vectorInfo.vector.getColumnVector() != null &&
((CarbonColumnVectorImpl) vectorInfo.vector
+ .getColumnVector()).isComplex()) {
+ fillComplexType(vector.getColumnVector(), pageDataType);
+ } else {
+ fillPrimitiveType(vector, vectorDataType, pageSize, pageDataType);
+ vector.setIndex(0);
+ }
+ }
+
+ private void fillComplexType(CarbonColumnVector vector, DataType
pageDataType) {
+ CarbonColumnVectorImpl vectorImpl = (CarbonColumnVectorImpl) vector;
+ if (vector != null && vector.getChildrenVector() != null) {
+ ArrayList<Integer> childElements = ((CarbonColumnVectorImpl)
vector).getChildrenElements();
+ for (int i = 0; i < childElements.size(); i++) {
+ int count = childElements.get(i);
+ typeComplexObject(vectorImpl.getChildrenVector().get(0), count,
pageDataType);
+ vector.putArrayObject();
+ }
+ }
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]