[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3773: [CARBONDATA-3830]Presto complex columns read support

2020-07-29 Thread GitBox


Indhumathi27 commented on a change in pull request #3773:
URL: https://github.com/apache/carbondata/pull/3773#discussion_r461655861



##
File path: 
core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedVectorResultCollector.java
##
@@ -98,6 +98,14 @@ void prepareDimensionAndMeasureColumnVectors() {
 columnVectorInfo.dimension = queryDimensions[i];
 columnVectorInfo.ordinal = 
queryDimensions[i].getDimension().getOrdinal();
 allColumnInfo[queryDimensions[i].getOrdinal()] = columnVectorInfo;
+  } else if (queryDimensions[i].getDimension().isComplex()) {
+ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
+complexList.add(columnVectorInfo);
+columnVectorInfo.dimension = queryDimensions[i];
+columnVectorInfo.ordinal = 
queryDimensions[i].getDimension().getOrdinal();
+columnVectorInfo.genericQueryType =
+
executionInfo.getComlexDimensionInfoMap().get(columnVectorInfo.ordinal);
+allColumnInfo[queryDimensions[i].getOrdinal()] = columnVectorInfo;

Review comment:
can add a check in line No.109 `  } else if 
(queryDimensions[i].getDimension().getDataType() != DataTypes.DATE && 
   !queryDimensions[i].getDimension().isComplex()) {` to avoid moving this 
method Up.





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




[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #3773: [CARBONDATA-3830]Presto complex columns read support

2020-06-01 Thread GitBox


Indhumathi27 commented on a change in pull request #3773:
URL: https://github.com/apache/carbondata/pull/3773#discussion_r433080176



##
File path: 
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java
##
@@ -247,6 +247,25 @@ public void decodeAndFillVector(byte[] pageData, 
ColumnVectorInfo vectorInfo, Bi
   DataType vectorDataType = vector.getType();
   vector = ColumnarVectorWrapperDirectFactory
   .getDirectVectorWrapperFactory(vector, null, nullBits, deletedRows, 
true, false);
+  CarbonColumnVector vectorColumn = null, childrenVectorInfo = null;
+  vectorColumn = vectorInfo.vector.getColumnVector();
+  if (vectorColumn != null) childrenVectorInfo = 
vectorColumn.getChildrenVector();

Review comment:
   Enclose if statement in braces

##
File path: 
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveIntegralCodec.java
##
@@ -308,15 +308,49 @@ public void decodeAndFillVector(byte[] pageData, 
ColumnVectorInfo vectorInfo, Bi
 private void fillVector(byte[] pageData, CarbonColumnVector vector, 
DataType vectorDataType,
 DataType pageDataType, int pageSize, ColumnVectorInfo vectorInfo, 
BitSet nullBits) {
   int rowId = 0;
+  CarbonColumnVector vectorColumn = null, childrenVectorInfo = null;
+  vectorColumn = vectorInfo.vector.getColumnVector();
+  if (vectorColumn != null) childrenVectorInfo = 
vectorColumn.getChildrenVector();

Review comment:
   Same code is added in AdaptiveFloatingCodec. Extract common code to a 
method and reuse

##
File path: 
integration/presto/src/main/prestosql/org/apache/carbondata/presto/readers/ArrayStreamReader.java
##
@@ -0,0 +1,113 @@
+/*
+ * 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.readers;
+
+import io.prestosql.spi.type.*;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.datatype.DataTypes;
+import 
org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl;
+
+import io.prestosql.spi.block.Block;
+import io.prestosql.spi.block.BlockBuilder;
+
+/**
+ * Class to read the Array Stream
+ */
+
+public class ArrayStreamReader extends CarbonColumnVectorImpl implements 
PrestoVectorBlockBuilder {
+
+  protected int batchSize;
+  protected Type type;
+  Block childBlock = null;
+  protected BlockBuilder builder;
+
+  public ArrayStreamReader(int batchSize, DataType dataType) {
+super(batchSize, dataType);
+this.batchSize = batchSize;
+if(dataType == DataTypes.STRING)

Review comment:
   enclose statements in braces

##
File path: 
core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
##
@@ -508,7 +508,7 @@ private BlockExecutionInfo 
getBlockExecutionInfoForBlock(QueryModel queryModel,
 int[] dimensionChunkIndexes = 
QueryUtil.getDimensionChunkIndexes(projectDimensions,
 segmentProperties.getDimensionOrdinalToChunkMapping(),
 currentBlockFilterDimensions, allProjectionListDimensionIdexes);
-ReusableDataBuffer[] dimensionBuffer = new 
ReusableDataBuffer[projectDimensions.size()];
+ReusableDataBuffer[] dimensionBuffer = new 
ReusableDataBuffer[projectDimensions.size() * 2];

Review comment:
   why this change?

##
File path: 
core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java
##
@@ -51,8 +51,8 @@
  */
 public class AdaptiveFloatingCodec extends AdaptiveCodec {
 
-  private double factor;
   private float floatFactor;
+  private double factor;

Review comment:
   Please revert this change

##
File path: 
core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedVectorResultCollector.java
##
@@ -98,6 +98,14 @@ void prepareDimensionAndMeasureColumnVectors() {
 columnVectorInfo.dimension = queryDimensions[i];
 columnVectorInfo.ordinal = 
queryDimensions[i].getDimension().getOrdinal();
 allColumnInfo[queryDimensions[i].getOrdinal()] = columnVectorInfo;
+  } else if (queryDimensions