You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by bhavya411 <gi...@git.apache.org> on 2017/07/06 07:07:40 UTC
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
GitHub user bhavya411 opened a pull request:
https://github.com/apache/carbondata/pull/1142
[CARBONDATA-1271] Enhanced Performance for Hive Integration with Carbondata
There are various fixes added to improve the performance
- Added a DictionaryDecodeReadSupport class in Hive Package to directly convert to ArrayWritable which is the default format for Hive
- Removed the colids checks as it was hampering performance and causing issues with Map jobs of Hive
- Implemented getPos() method to return the rowCount
- Made changes in core classes to support Hive Query Statistics
- Improved and simplified CarbonHiveSerde
- Support for Array Type and Struct Type added in the Integration
- Build passed with all test cases executing successfully for Spark 2.1 and Hadoop 2.7.2
- Tested Manually for all the queries
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bhavya411/incubator-carbondata CARBONDATA-1271
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/carbondata/pull/1142.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1142
----
commit 9d90aea6af7d433402e809dec957d12563a274c1
Author: Bhavya <bh...@knoldus.com>
Date: 2017-07-06T06:23:03Z
Fixed performance issue for Hive Integration
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2952/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2951/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126077264
--- Diff: core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java ---
@@ -101,45 +101,47 @@ public String collectExecutorStatistics() {
long scannedPages = 0;
try {
for (QueryStatistic statistic : queryStatistics) {
- switch (statistic.getMessage()) {
- case QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR:
- load_blocks_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.SCAN_BLOCKlET_TIME:
- scan_blocks_time += statistic.getCount();
- break;
- case QueryStatisticsConstants.SCAN_BLOCKS_NUM:
- scan_blocks_num += statistic.getCount();
- break;
- case QueryStatisticsConstants.LOAD_DICTIONARY:
- load_dictionary_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.RESULT_SIZE:
- result_size += statistic.getCount();
- break;
- case QueryStatisticsConstants.EXECUTOR_PART:
- total_executor_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.TOTAL_BLOCKLET_NUM:
- total_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM:
- valid_scan_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.VALID_PAGE_SCANNED:
- valid_pages_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.TOTAL_PAGE_SCANNED:
- total_pages = statistic.getCount();
- break;
- case QueryStatisticsConstants.READ_BLOCKlET_TIME:
- readTime = statistic.getCount();
- break;
- case QueryStatisticsConstants.PAGE_SCANNED:
- scannedPages = statistic.getCount();
- break;
- default:
- break;
+ if (statistic.getMessage() != null) {
--- End diff --
Since I added an IF statement the switch statement needs to shift to the right to maintain the code formatting, so that is the reason the format has changed
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/345/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2931/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on the issue:
https://github.com/apache/carbondata/pull/1142
retest this please
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on the issue:
https://github.com/apache/carbondata/pull/1142
LGTM
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:
https://github.com/apache/carbondata/pull/1142
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/3031/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126070269
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
+
+ protected Dictionary[] dictionaries;
+
+ protected DataType[] dataTypes;
+ /**
+ * carbon columns
+ */
+ protected CarbonColumn[] carbonColumns;
+
+ protected Writable[] writableArr;
+
+ /**
+ * This initialization is done inside executor task
+ * for column dictionary involved in decoding.
+ *
+ * @param carbonColumns column list
+ * @param absoluteTableIdentifier table identifier
+ */
+ @Override public void initialize(CarbonColumn[] carbonColumns,
+ AbsoluteTableIdentifier absoluteTableIdentifier) throws IOException {
+ this.carbonColumns = carbonColumns;
+ dictionaries = new Dictionary[carbonColumns.length];
+ dataTypes = new DataType[carbonColumns.length];
+ for (int i = 0; i < carbonColumns.length; i++) {
+ if (carbonColumns[i].hasEncoding(Encoding.DICTIONARY) && !carbonColumns[i]
+ .hasEncoding(Encoding.DIRECT_DICTIONARY) && !carbonColumns[i].isComplex()) {
+ CacheProvider cacheProvider = CacheProvider.getInstance();
+ Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider
+ .createCache(CacheType.FORWARD_DICTIONARY, absoluteTableIdentifier.getStorePath());
+ dataTypes[i] = carbonColumns[i].getDataType();
+ dictionaries[i] = forwardDictionaryCache.get(
+ new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier.getCarbonTableIdentifier(),
+ carbonColumns[i].getColumnIdentifier(), dataTypes[i]));
+ } else {
+ dataTypes[i] = carbonColumns[i].getDataType();
+ }
+ }
+ }
+
+ @Override public T readRow(Object[] data) {
+ assert (data.length == dictionaries.length);
+ writableArr = new Writable[data.length];
+ for (int i = 0; i < dictionaries.length; i++) {
+ if (dictionaries[i] != null) {
+ data[i] = dictionaries[i].getDictionaryValueForKey((int) data[i]);
+ }
+ try {
+ writableArr[i] = createWritableObject(data[i], carbonColumns[i]);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ return (T) writableArr;
+ }
+
+ /**
+ * to book keep the dictionary cache or update access count for each
+ * column involved during decode, to facilitate LRU cache policy if memory
+ * threshold is reached
+ */
+ @Override public void close() {
+ if (dictionaries == null) {
+ return;
+ }
+ for (int i = 0; i < dictionaries.length; i++) {
+ CarbonUtil.clearDictionaryCache(dictionaries[i]);
+ }
+ }
+
+ /**
+ * To Create the Writable from the CarbonData data
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritableObject(Object obj, CarbonColumn carbonColumn) throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ switch (dataType) {
+ case STRUCT:
+ return createStruct(obj, carbonColumn);
+ case ARRAY:
+ return createArray(obj, carbonColumn);
+ default:
+ return createWritablePrimitive(obj, carbonColumn);
+ }
+ }
+
+ /**
+ * Create Array Data for Array Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createArray(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericArrayData) {
+
+ Object[] objArray = ((GenericArrayData) obj).array();
+ List<CarbonDimension> childCarbonDimensions = null;
+ CarbonDimension arrayDimension = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ arrayDimension = childCarbonDimensions.get(0);
+ }
+ List array = new ArrayList();
+ if (objArray != null) {
+ for (int i = 0; i < objArray.length; i++) {
+ Object curObj = objArray[i];
+ Writable newObj = createWritableObject(curObj, arrayDimension);
+ array.add(newObj);
+ }
+ }
+ if (array.size() > 0) {
+ ArrayWritable subArray = new ArrayWritable(Writable.class,
+ (Writable[]) array.toArray(new Writable[array.size()]));
+ return new ArrayWritable(Writable.class, new Writable[] { subArray });
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create the Struct data for the Struct Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createStruct(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericInternalRow) {
+ Object[] objArray = ((GenericInternalRow) obj).values();
+ List<CarbonDimension> childCarbonDimensions = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ }
+ Writable[] arr = new Writable[objArray.length];
+ for (int i = 0; i < objArray.length; i++) {
+
+ arr[i] = createWritableObject(objArray[i], childCarbonDimensions.get(i));
+ }
+ return new ArrayWritable(Writable.class, arr);
+ }
+ throw new IOException("DataType not supported in Carbondata");
+ }
+
+ /**
+ * This method will create the Writable Objects for primitives.
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritablePrimitive(Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ return null;
+ }
+ switch (dataType) {
+ case NULL:
+ return null;
+ case DOUBLE:
+ return new DoubleWritable((double) obj);
+ case INT:
+ return new IntWritable((int) obj);
+ case LONG:
+ return new LongWritable((long) obj);
+ case SHORT:
+ return new ShortWritable((Short) obj);
+ case DATE:
+ return new DateWritable(new Date((Integer) obj));
+ case TIMESTAMP:
+ return new TimestampWritable(new Timestamp((long) obj));
+ case STRING:
+ return new Text(obj.toString());
+ case DECIMAL:
+ return new HiveDecimalWritable(
+ HiveDecimal.create(((org.apache.spark.sql.types.Decimal) obj).toJavaBigDecimal()));
+ }
+ throw new IOException("Unknown primitive : " + dataType.getName());
+ }
+
+ /**
+ * If we need to use the same Writable[] then we can use this method
+ *
+ * @param writable
+ * @param obj
+ * @param carbonColumn
+ * @throws IOException
+ */
+ private void setPrimitive(Writable writable, Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ writable.write(null);
+ }
+ switch (dataType) {
+ case DOUBLE:
+ ((DoubleWritable) writable).set((double) obj);
+ break;
+ case INT:
+ ((IntWritable) writable).set((int) obj);
+ break;
+ case LONG:
+ ((LongWritable) writable).set((long) obj);
+ break;
+ case SHORT:
+ ((ShortWritable) writable).set((short) obj);
+ break;
+ case DATE:
+ ((DateWritable) writable).set(new Date((Long) obj));
+ break;
+ case TIMESTAMP:
+ ((TimestampWritable) writable).set(new Timestamp((long) obj));
+ break;
+ case STRING:
+ ((Text) writable).set(obj.toString());
+ break;
+ case DECIMAL:
+ ((HiveDecimalWritable) writable)
--- End diff --
Please don't use spark's decimal, you can refer to pr 1110
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Failed with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/341/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by cenyuhai <gi...@git.apache.org>.
Github user cenyuhai commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126298624
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java ---
@@ -88,17 +90,12 @@ private void initialize(InputSplit inputSplit, Configuration conf) throws IOExce
} catch (QueryExecutionException e) {
throw new IOException(e.getMessage(), e.getCause());
}
- if (valueObj == null) {
- valueObj =
- new ArrayWritable(Writable.class, new Writable[queryModel.getProjectionColumns().length]);
- }
-
final TypeInfo rowTypeInfo;
final List<String> columnNames;
List<TypeInfo> columnTypes;
// Get column names and sort order
final String colIds = conf.get("hive.io.file.readcolumn.ids");
- final String columnNameProperty = conf.get("hive.io.file.readcolumn.names");
+ final String columnNameProperty = conf.get(serdeConstants.LIST_COLUMNS);
--- End diff --
why change to serdeConstants.LIST_COLUMNS? I had got columnNameProperty from serdeConstants.LIST_COLUMNS, but I found that the columns in serdeConstants.LIST_COLUMNS sometimes contains columns which don't belong to this table
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/443/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2954/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2927/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126070302
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
+
+ protected Dictionary[] dictionaries;
+
+ protected DataType[] dataTypes;
+ /**
+ * carbon columns
+ */
+ protected CarbonColumn[] carbonColumns;
+
+ protected Writable[] writableArr;
+
+ /**
+ * This initialization is done inside executor task
+ * for column dictionary involved in decoding.
+ *
+ * @param carbonColumns column list
+ * @param absoluteTableIdentifier table identifier
+ */
+ @Override public void initialize(CarbonColumn[] carbonColumns,
+ AbsoluteTableIdentifier absoluteTableIdentifier) throws IOException {
+ this.carbonColumns = carbonColumns;
+ dictionaries = new Dictionary[carbonColumns.length];
+ dataTypes = new DataType[carbonColumns.length];
+ for (int i = 0; i < carbonColumns.length; i++) {
+ if (carbonColumns[i].hasEncoding(Encoding.DICTIONARY) && !carbonColumns[i]
+ .hasEncoding(Encoding.DIRECT_DICTIONARY) && !carbonColumns[i].isComplex()) {
+ CacheProvider cacheProvider = CacheProvider.getInstance();
+ Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider
+ .createCache(CacheType.FORWARD_DICTIONARY, absoluteTableIdentifier.getStorePath());
+ dataTypes[i] = carbonColumns[i].getDataType();
+ dictionaries[i] = forwardDictionaryCache.get(
+ new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier.getCarbonTableIdentifier(),
+ carbonColumns[i].getColumnIdentifier(), dataTypes[i]));
+ } else {
+ dataTypes[i] = carbonColumns[i].getDataType();
+ }
+ }
+ }
+
+ @Override public T readRow(Object[] data) {
+ assert (data.length == dictionaries.length);
+ writableArr = new Writable[data.length];
+ for (int i = 0; i < dictionaries.length; i++) {
+ if (dictionaries[i] != null) {
+ data[i] = dictionaries[i].getDictionaryValueForKey((int) data[i]);
+ }
+ try {
+ writableArr[i] = createWritableObject(data[i], carbonColumns[i]);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ return (T) writableArr;
+ }
+
+ /**
+ * to book keep the dictionary cache or update access count for each
+ * column involved during decode, to facilitate LRU cache policy if memory
+ * threshold is reached
+ */
+ @Override public void close() {
+ if (dictionaries == null) {
+ return;
+ }
+ for (int i = 0; i < dictionaries.length; i++) {
+ CarbonUtil.clearDictionaryCache(dictionaries[i]);
+ }
+ }
+
+ /**
+ * To Create the Writable from the CarbonData data
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritableObject(Object obj, CarbonColumn carbonColumn) throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ switch (dataType) {
+ case STRUCT:
+ return createStruct(obj, carbonColumn);
+ case ARRAY:
+ return createArray(obj, carbonColumn);
+ default:
+ return createWritablePrimitive(obj, carbonColumn);
+ }
+ }
+
+ /**
+ * Create Array Data for Array Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createArray(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericArrayData) {
+
+ Object[] objArray = ((GenericArrayData) obj).array();
+ List<CarbonDimension> childCarbonDimensions = null;
+ CarbonDimension arrayDimension = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ arrayDimension = childCarbonDimensions.get(0);
+ }
+ List array = new ArrayList();
+ if (objArray != null) {
+ for (int i = 0; i < objArray.length; i++) {
+ Object curObj = objArray[i];
+ Writable newObj = createWritableObject(curObj, arrayDimension);
+ array.add(newObj);
+ }
+ }
+ if (array.size() > 0) {
+ ArrayWritable subArray = new ArrayWritable(Writable.class,
+ (Writable[]) array.toArray(new Writable[array.size()]));
+ return new ArrayWritable(Writable.class, new Writable[] { subArray });
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create the Struct data for the Struct Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createStruct(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericInternalRow) {
+ Object[] objArray = ((GenericInternalRow) obj).values();
+ List<CarbonDimension> childCarbonDimensions = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ }
+ Writable[] arr = new Writable[objArray.length];
+ for (int i = 0; i < objArray.length; i++) {
+
+ arr[i] = createWritableObject(objArray[i], childCarbonDimensions.get(i));
+ }
+ return new ArrayWritable(Writable.class, arr);
+ }
+ throw new IOException("DataType not supported in Carbondata");
+ }
+
+ /**
+ * This method will create the Writable Objects for primitives.
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritablePrimitive(Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ return null;
+ }
+ switch (dataType) {
+ case NULL:
+ return null;
+ case DOUBLE:
+ return new DoubleWritable((double) obj);
+ case INT:
+ return new IntWritable((int) obj);
+ case LONG:
+ return new LongWritable((long) obj);
+ case SHORT:
+ return new ShortWritable((Short) obj);
+ case DATE:
+ return new DateWritable(new Date((Integer) obj));
+ case TIMESTAMP:
+ return new TimestampWritable(new Timestamp((long) obj));
+ case STRING:
+ return new Text(obj.toString());
+ case DECIMAL:
+ return new HiveDecimalWritable(
--- End diff --
Please don't use spark's decimal, you can refer to pr 1110
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126273765
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java ---
@@ -111,58 +108,46 @@ private void initialize(InputSplit inputSplit, Configuration conf) throws IOExce
} else {
columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty);
}
+
+ if (valueObj == null) {
+ valueObj = new ArrayWritable(Writable.class, new Writable[columnTypes.size()]);
+ }
--- End diff --
columnTypes.size() and queryModel.getProjectionColumns().length is different, why need to do this change ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/365/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/442/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126273657
--- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java ---
@@ -444,9 +444,14 @@ protected Expression getFilterPredicates(Configuration configuration) {
}
}
}
+
+ // For Hive integration if we have to get the stats we have to fetch hive.query.id
+ String query_id = job.getConfiguration().get("query.id") != null ?
+ job.getConfiguration().get("query.id") :
+ job.getConfiguration().get("hive.query.id");
--- End diff --
question : where set "hive.query.id"? from hive engine ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Failed with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/363/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126119465
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
+
+ protected Dictionary[] dictionaries;
+
+ protected DataType[] dataTypes;
+ /**
+ * carbon columns
+ */
+ protected CarbonColumn[] carbonColumns;
+
+ protected Writable[] writableArr;
+
+ /**
+ * This initialization is done inside executor task
+ * for column dictionary involved in decoding.
+ *
+ * @param carbonColumns column list
+ * @param absoluteTableIdentifier table identifier
+ */
+ @Override public void initialize(CarbonColumn[] carbonColumns,
+ AbsoluteTableIdentifier absoluteTableIdentifier) throws IOException {
+ this.carbonColumns = carbonColumns;
+ dictionaries = new Dictionary[carbonColumns.length];
+ dataTypes = new DataType[carbonColumns.length];
+ for (int i = 0; i < carbonColumns.length; i++) {
+ if (carbonColumns[i].hasEncoding(Encoding.DICTIONARY) && !carbonColumns[i]
+ .hasEncoding(Encoding.DIRECT_DICTIONARY) && !carbonColumns[i].isComplex()) {
+ CacheProvider cacheProvider = CacheProvider.getInstance();
+ Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider
+ .createCache(CacheType.FORWARD_DICTIONARY, absoluteTableIdentifier.getStorePath());
+ dataTypes[i] = carbonColumns[i].getDataType();
+ dictionaries[i] = forwardDictionaryCache.get(
+ new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier.getCarbonTableIdentifier(),
+ carbonColumns[i].getColumnIdentifier(), dataTypes[i]));
+ } else {
+ dataTypes[i] = carbonColumns[i].getDataType();
+ }
+ }
+ }
+
+ @Override public T readRow(Object[] data) {
+ assert (data.length == dictionaries.length);
+ writableArr = new Writable[data.length];
+ for (int i = 0; i < dictionaries.length; i++) {
+ if (dictionaries[i] != null) {
+ data[i] = dictionaries[i].getDictionaryValueForKey((int) data[i]);
+ }
+ try {
+ writableArr[i] = createWritableObject(data[i], carbonColumns[i]);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ return (T) writableArr;
+ }
+
+ /**
+ * to book keep the dictionary cache or update access count for each
+ * column involved during decode, to facilitate LRU cache policy if memory
+ * threshold is reached
+ */
+ @Override public void close() {
+ if (dictionaries == null) {
+ return;
+ }
+ for (int i = 0; i < dictionaries.length; i++) {
+ CarbonUtil.clearDictionaryCache(dictionaries[i]);
+ }
+ }
+
+ /**
+ * To Create the Writable from the CarbonData data
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritableObject(Object obj, CarbonColumn carbonColumn) throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ switch (dataType) {
+ case STRUCT:
+ return createStruct(obj, carbonColumn);
+ case ARRAY:
+ return createArray(obj, carbonColumn);
+ default:
+ return createWritablePrimitive(obj, carbonColumn);
+ }
+ }
+
+ /**
+ * Create Array Data for Array Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createArray(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericArrayData) {
+
+ Object[] objArray = ((GenericArrayData) obj).array();
+ List<CarbonDimension> childCarbonDimensions = null;
+ CarbonDimension arrayDimension = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ arrayDimension = childCarbonDimensions.get(0);
+ }
+ List array = new ArrayList();
+ if (objArray != null) {
+ for (int i = 0; i < objArray.length; i++) {
+ Object curObj = objArray[i];
+ Writable newObj = createWritableObject(curObj, arrayDimension);
+ array.add(newObj);
+ }
+ }
+ if (array.size() > 0) {
+ ArrayWritable subArray = new ArrayWritable(Writable.class,
+ (Writable[]) array.toArray(new Writable[array.size()]));
+ return new ArrayWritable(Writable.class, new Writable[] { subArray });
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create the Struct data for the Struct Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createStruct(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericInternalRow) {
+ Object[] objArray = ((GenericInternalRow) obj).values();
+ List<CarbonDimension> childCarbonDimensions = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ }
+ Writable[] arr = new Writable[objArray.length];
+ for (int i = 0; i < objArray.length; i++) {
+
+ arr[i] = createWritableObject(objArray[i], childCarbonDimensions.get(i));
+ }
+ return new ArrayWritable(Writable.class, arr);
+ }
+ throw new IOException("DataType not supported in Carbondata");
+ }
+
+ /**
+ * This method will create the Writable Objects for primitives.
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritablePrimitive(Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ return null;
+ }
+ switch (dataType) {
+ case NULL:
+ return null;
+ case DOUBLE:
+ return new DoubleWritable((double) obj);
+ case INT:
+ return new IntWritable((int) obj);
+ case LONG:
+ return new LongWritable((long) obj);
+ case SHORT:
+ return new ShortWritable((Short) obj);
+ case DATE:
+ return new DateWritable(new Date((Integer) obj));
+ case TIMESTAMP:
+ return new TimestampWritable(new Timestamp((long) obj));
+ case STRING:
+ return new Text(obj.toString());
+ case DECIMAL:
+ return new HiveDecimalWritable(
--- End diff --
Have fixed the issue now using BigDecimal
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on the issue:
https://github.com/apache/carbondata/pull/1142
@cenyuhai The performance improved a lot I tested it with 5 Million records please see the attached results
[Performance.txt](https://github.com/apache/carbondata/files/1135276/Performance.txt)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/3030/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Failed with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/364/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on the issue:
https://github.com/apache/carbondata/pull/1142
LGTM
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126392544
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java ---
@@ -111,58 +108,46 @@ private void initialize(InputSplit inputSplit, Configuration conf) throws IOExce
} else {
columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty);
}
+
+ if (valueObj == null) {
+ valueObj = new ArrayWritable(Writable.class, new Writable[columnTypes.size()]);
+ }
--- End diff --
Actually the data structure should be consistent, initially we were just returning the project columns and the Arraywritable was having variable length but in Parquet and ORC both implementation the ArrayWritable length was equivalent to the number of columns in table . It was causing issues in TPCh queries so that's why made changes to have Arraywritable size equivalent to number of columns and then populate the data at respective position
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126392125
--- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonInputFormat.java ---
@@ -444,9 +444,14 @@ protected Expression getFilterPredicates(Configuration configuration) {
}
}
}
+
+ // For Hive integration if we have to get the stats we have to fetch hive.query.id
+ String query_id = job.getConfiguration().get("query.id") != null ?
+ job.getConfiguration().get("query.id") :
+ job.getConfiguration().get("hive.query.id");
--- End diff --
It is set in the configuration internally by Hive
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by cenyuhai <gi...@git.apache.org>.
Github user cenyuhai commented on the issue:
https://github.com/apache/carbondata/pull/1142
Can you provide performance benchmark?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126392840
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
--- End diff --
Will change the file name to CarbonDictionaryDecodeReadSupport.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by bhavya411 <gi...@git.apache.org>.
Github user bhavya411 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126119484
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
+
+ protected Dictionary[] dictionaries;
+
+ protected DataType[] dataTypes;
+ /**
+ * carbon columns
+ */
+ protected CarbonColumn[] carbonColumns;
+
+ protected Writable[] writableArr;
+
+ /**
+ * This initialization is done inside executor task
+ * for column dictionary involved in decoding.
+ *
+ * @param carbonColumns column list
+ * @param absoluteTableIdentifier table identifier
+ */
+ @Override public void initialize(CarbonColumn[] carbonColumns,
+ AbsoluteTableIdentifier absoluteTableIdentifier) throws IOException {
+ this.carbonColumns = carbonColumns;
+ dictionaries = new Dictionary[carbonColumns.length];
+ dataTypes = new DataType[carbonColumns.length];
+ for (int i = 0; i < carbonColumns.length; i++) {
+ if (carbonColumns[i].hasEncoding(Encoding.DICTIONARY) && !carbonColumns[i]
+ .hasEncoding(Encoding.DIRECT_DICTIONARY) && !carbonColumns[i].isComplex()) {
+ CacheProvider cacheProvider = CacheProvider.getInstance();
+ Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider
+ .createCache(CacheType.FORWARD_DICTIONARY, absoluteTableIdentifier.getStorePath());
+ dataTypes[i] = carbonColumns[i].getDataType();
+ dictionaries[i] = forwardDictionaryCache.get(
+ new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier.getCarbonTableIdentifier(),
+ carbonColumns[i].getColumnIdentifier(), dataTypes[i]));
+ } else {
+ dataTypes[i] = carbonColumns[i].getDataType();
+ }
+ }
+ }
+
+ @Override public T readRow(Object[] data) {
+ assert (data.length == dictionaries.length);
+ writableArr = new Writable[data.length];
+ for (int i = 0; i < dictionaries.length; i++) {
+ if (dictionaries[i] != null) {
+ data[i] = dictionaries[i].getDictionaryValueForKey((int) data[i]);
+ }
+ try {
+ writableArr[i] = createWritableObject(data[i], carbonColumns[i]);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ return (T) writableArr;
+ }
+
+ /**
+ * to book keep the dictionary cache or update access count for each
+ * column involved during decode, to facilitate LRU cache policy if memory
+ * threshold is reached
+ */
+ @Override public void close() {
+ if (dictionaries == null) {
+ return;
+ }
+ for (int i = 0; i < dictionaries.length; i++) {
+ CarbonUtil.clearDictionaryCache(dictionaries[i]);
+ }
+ }
+
+ /**
+ * To Create the Writable from the CarbonData data
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritableObject(Object obj, CarbonColumn carbonColumn) throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ switch (dataType) {
+ case STRUCT:
+ return createStruct(obj, carbonColumn);
+ case ARRAY:
+ return createArray(obj, carbonColumn);
+ default:
+ return createWritablePrimitive(obj, carbonColumn);
+ }
+ }
+
+ /**
+ * Create Array Data for Array Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createArray(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericArrayData) {
+
+ Object[] objArray = ((GenericArrayData) obj).array();
+ List<CarbonDimension> childCarbonDimensions = null;
+ CarbonDimension arrayDimension = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ arrayDimension = childCarbonDimensions.get(0);
+ }
+ List array = new ArrayList();
+ if (objArray != null) {
+ for (int i = 0; i < objArray.length; i++) {
+ Object curObj = objArray[i];
+ Writable newObj = createWritableObject(curObj, arrayDimension);
+ array.add(newObj);
+ }
+ }
+ if (array.size() > 0) {
+ ArrayWritable subArray = new ArrayWritable(Writable.class,
+ (Writable[]) array.toArray(new Writable[array.size()]));
+ return new ArrayWritable(Writable.class, new Writable[] { subArray });
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create the Struct data for the Struct Datatype
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private ArrayWritable createStruct(Object obj, CarbonColumn carbonColumn) throws IOException {
+ if (obj instanceof GenericInternalRow) {
+ Object[] objArray = ((GenericInternalRow) obj).values();
+ List<CarbonDimension> childCarbonDimensions = null;
+ if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) {
+ childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions();
+ }
+ Writable[] arr = new Writable[objArray.length];
+ for (int i = 0; i < objArray.length; i++) {
+
+ arr[i] = createWritableObject(objArray[i], childCarbonDimensions.get(i));
+ }
+ return new ArrayWritable(Writable.class, arr);
+ }
+ throw new IOException("DataType not supported in Carbondata");
+ }
+
+ /**
+ * This method will create the Writable Objects for primitives.
+ *
+ * @param obj
+ * @param carbonColumn
+ * @return
+ * @throws IOException
+ */
+ private Writable createWritablePrimitive(Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ return null;
+ }
+ switch (dataType) {
+ case NULL:
+ return null;
+ case DOUBLE:
+ return new DoubleWritable((double) obj);
+ case INT:
+ return new IntWritable((int) obj);
+ case LONG:
+ return new LongWritable((long) obj);
+ case SHORT:
+ return new ShortWritable((Short) obj);
+ case DATE:
+ return new DateWritable(new Date((Integer) obj));
+ case TIMESTAMP:
+ return new TimestampWritable(new Timestamp((long) obj));
+ case STRING:
+ return new Text(obj.toString());
+ case DECIMAL:
+ return new HiveDecimalWritable(
+ HiveDecimal.create(((org.apache.spark.sql.types.Decimal) obj).toJavaBigDecimal()));
+ }
+ throw new IOException("Unknown primitive : " + dataType.getName());
+ }
+
+ /**
+ * If we need to use the same Writable[] then we can use this method
+ *
+ * @param writable
+ * @param obj
+ * @param carbonColumn
+ * @throws IOException
+ */
+ private void setPrimitive(Writable writable, Object obj, CarbonColumn carbonColumn)
+ throws IOException {
+ DataType dataType = carbonColumn.getDataType();
+ if (obj == null) {
+ writable.write(null);
+ }
+ switch (dataType) {
+ case DOUBLE:
+ ((DoubleWritable) writable).set((double) obj);
+ break;
+ case INT:
+ ((IntWritable) writable).set((int) obj);
+ break;
+ case LONG:
+ ((LongWritable) writable).set((long) obj);
+ break;
+ case SHORT:
+ ((ShortWritable) writable).set((short) obj);
+ break;
+ case DATE:
+ ((DateWritable) writable).set(new Date((Long) obj));
+ break;
+ case TIMESTAMP:
+ ((TimestampWritable) writable).set(new Timestamp((long) obj));
+ break;
+ case STRING:
+ ((Text) writable).set(obj.toString());
+ break;
+ case DECIMAL:
+ ((HiveDecimalWritable) writable)
--- End diff --
Have fixed the issue now using BigDecimal
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/carbondata/pull/1142
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126274038
--- Diff: integration/hive/src/main/java/org/apache/carbondata/hive/DictionaryDecodeReadSupport.java ---
@@ -0,0 +1,288 @@
+/*
+ * 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.hive;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.cache.Cache;
+import org.apache.carbondata.core.cache.CacheProvider;
+import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.cache.dictionary.Dictionary;
+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.core.util.CarbonUtil;
+
+import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.ShortWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+
+import org.apache.hadoop.io.ArrayWritable;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
+
+import org.apache.spark.sql.catalyst.expressions.GenericInternalRow;
+import org.apache.spark.sql.catalyst.util.GenericArrayData;
+
+/**
+ * This is the class to decode dictionary encoded column data back to its original value.
+ */
+public class DictionaryDecodeReadSupport<T> implements CarbonReadSupport<T> {
--- End diff --
suggest changing this name to "CarbonDictionaryDecodeReadSupport"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1142
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2950/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata issue #1142: [CARBONDATA-1271] Enhanced Performance for Hive Inte...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:
https://github.com/apache/carbondata/pull/1142
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] carbondata pull request #1142: [CARBONDATA-1271] Enhanced Performance for Hi...
Posted by chenliang613 <gi...@git.apache.org>.
Github user chenliang613 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1142#discussion_r126056257
--- Diff: core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java ---
@@ -101,45 +101,47 @@ public String collectExecutorStatistics() {
long scannedPages = 0;
try {
for (QueryStatistic statistic : queryStatistics) {
- switch (statistic.getMessage()) {
- case QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR:
- load_blocks_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.SCAN_BLOCKlET_TIME:
- scan_blocks_time += statistic.getCount();
- break;
- case QueryStatisticsConstants.SCAN_BLOCKS_NUM:
- scan_blocks_num += statistic.getCount();
- break;
- case QueryStatisticsConstants.LOAD_DICTIONARY:
- load_dictionary_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.RESULT_SIZE:
- result_size += statistic.getCount();
- break;
- case QueryStatisticsConstants.EXECUTOR_PART:
- total_executor_time += statistic.getTimeTaken();
- break;
- case QueryStatisticsConstants.TOTAL_BLOCKLET_NUM:
- total_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM:
- valid_scan_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.VALID_PAGE_SCANNED:
- valid_pages_blocklet = statistic.getCount();
- break;
- case QueryStatisticsConstants.TOTAL_PAGE_SCANNED:
- total_pages = statistic.getCount();
- break;
- case QueryStatisticsConstants.READ_BLOCKlET_TIME:
- readTime = statistic.getCount();
- break;
- case QueryStatisticsConstants.PAGE_SCANNED:
- scannedPages = statistic.getCount();
- break;
- default:
- break;
+ if (statistic.getMessage() != null) {
--- End diff --
question : only add one row code "if (statistic.getMessage() != null)", why need to change other code format ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---