kumarvishal09 commented on a change in pull request #3887: URL: https://github.com/apache/carbondata/pull/3887#discussion_r477292131
########## File path: core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveCodec.java ########## @@ -260,4 +265,65 @@ protected String debugInfo() { return this.toString(); } + public static VectorUtil checkAndUpdateToChildVector(ColumnVectorInfo vectorInfo, int pageSize, + CarbonColumnVector vector, DataType vectorDataType) { + VectorUtil vectorUtil = new VectorUtil(pageSize, vector, vectorDataType); + Stack<CarbonColumnVector> vectorStack = vectorInfo.getVectorStack(); + // check and update to child vector info + if (vectorStack != null && vectorStack.peek() != null && vectorDataType.isComplexType()) { + if (DataTypes.isArrayType(vectorDataType)) { + List<Integer> childElementsCountForEachRow = + ((CarbonColumnVectorImpl) vector.getColumnVector()) + .getNumberOfChildrenElementsInEachRow(); + int newPageSize = 0; + for (int childElementsCount : childElementsCountForEachRow) { + newPageSize += childElementsCount; + } + vectorUtil.setPageSize(newPageSize); + } + // child vector flow, so fill the child vector + CarbonColumnVector childVector = vectorStack.pop(); + vectorUtil.setVector(childVector); + vectorUtil.setVectorDataType(childVector.getType()); + } + return vectorUtil; + } + + // Utility class to update current vector to child vector in case of complex type handling + public static class VectorUtil { + private int pageSize; + private CarbonColumnVector vector; + private DataType vectorDataType; + + private VectorUtil(int pageSize, CarbonColumnVector vector, DataType vectorDataType) { + this.pageSize = pageSize; + this.vector = vector; + this.vectorDataType = vectorDataType; + } + + public int getPageSize() { Review comment: we can use org.apache.commons.lang3.tuple class for returning 3 args from one method , pls check if you can use here ---------------------------------------------------------------- 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: us...@infra.apache.org