You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by akashrn5 <gi...@git.apache.org> on 2018/06/22 15:46:37 UTC
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
GitHub user akashrn5 opened a pull request:
https://github.com/apache/carbondata/pull/2401
[CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]Local dictionary support for alter table, preaggregate and varchar datatype
What changes were proposed in this pull request?
In this PR,
local dictionary support is added for alter table, preaggregate and varChar datatype
All the validations related to above features are taken care in this PR
How was this patch tested?
UTs and SDV test cases are added in the same PR
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/akashrn5/incubator-carbondata local_dict_for_alter_preagg
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/carbondata/pull/2401.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 #2401
----
----
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6482/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5457/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6637/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5461/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5480/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5443/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6570/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by brijoobopanna <gi...@git.apache.org>.
Github user brijoobopanna commented on the issue:
https://github.com/apache/carbondata/pull/2401
retest this please
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
LGTM
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on the issue:
https://github.com/apache/carbondata/pull/2401
retest this please
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5368/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/carbondata/pull/2401
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6580/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5419/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5312/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5404/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198442294
--- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala ---
@@ -615,4 +618,114 @@ object CarbonScalaUtil {
sparkSession,
schema)._1.asInstanceOf[Object]
}
+
+ /**
+ * this method validates the local dictionary columns configurations
+ *
+ * @param tableProperties
+ * @param localDictColumns
+ */
+ def validateLocalDictionaryColumns(tableProperties: mutable.Map[String, String],
+ localDictColumns: Seq[String]): Unit = {
+ var dictIncludeColumns: Seq[String] = Seq[String]()
+
+ // check if the duplicate columns are specified in table schema
+ if (localDictColumns.distinct.lengthCompare(localDictColumns.size) != 0) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
+ .diff((dictIncludeColumns ++ localDictColumns).distinct).distinct
+ val errMsg =
+ "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE contains Duplicate Columns: " +
+ duplicateColumns.mkString(",") +
+ ". Please check create table statement."
+ throw new MalformedCarbonCommandException(errMsg)
+ }
+
+ // check if the same column is present in both dictionary include and local dictionary columns
+ // configuration
+ if (tableProperties.get(CarbonCommonConstants.DICTIONARY_INCLUDE).isDefined) {
+ dictIncludeColumns =
+ tableProperties(CarbonCommonConstants.DICTIONARY_INCLUDE).split(",").map(_.trim)
+ localDictColumns.foreach { distCol =>
+ if (dictIncludeColumns.exists(x => x.equalsIgnoreCase(distCol.trim))) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
+ .diff((dictIncludeColumns ++ localDictColumns).distinct).distinct
--- End diff --
I think you require common columns not difference columns here
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198443241
--- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala ---
@@ -615,4 +618,114 @@ object CarbonScalaUtil {
sparkSession,
schema)._1.asInstanceOf[Object]
}
+
+ /**
+ * this method validates the local dictionary columns configurations
+ *
+ * @param tableProperties
+ * @param localDictColumns
+ */
+ def validateLocalDictionaryColumns(tableProperties: mutable.Map[String, String],
+ localDictColumns: Seq[String]): Unit = {
+ var dictIncludeColumns: Seq[String] = Seq[String]()
+
+ // check if the duplicate columns are specified in table schema
+ if (localDictColumns.distinct.lengthCompare(localDictColumns.size) != 0) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
--- End diff --
yes, it is not required, will remove that
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6628/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on the issue:
https://github.com/apache/carbondata/pull/2401
retest this please
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6600/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5313/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198387868
--- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ---
@@ -1110,9 +1110,18 @@ private static void setLocalDictInfo(CarbonTable table, TableInfo tableInfo) {
String localDictionaryThreshold = tableInfo.getFactTable().getTableProperties()
.get(CarbonCommonConstants.LOCAL_DICTIONARY_THRESHOLD);
if (null != isLocalDictionaryEnabled) {
- table.setLocalDictionaryEnabled(Boolean.parseBoolean(isLocalDictionaryEnabled));
+ // if table is altered then, for same key in table properties, multiple values will be
--- End diff --
remove this code if unused
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5465/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5398/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6539/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by zzcclp <gi...@git.apache.org>.
Github user zzcclp commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r199105619
--- Diff: core/src/test/java/org/apache/carbondata/core/localdictionary/TestLocalDictionaryGenerator.java ---
@@ -0,0 +1,72 @@
+/*
+ * 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.localdictionary;
+
+import java.util.Arrays;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.localdictionary.exception.DictionaryThresholdReachedException;
+import org.apache.carbondata.core.localdictionary.generator.ColumnLocalDictionaryGenerator;
+import org.apache.carbondata.core.localdictionary.generator.LocalDictionaryGenerator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestLocalDictionaryGenerator {
+
+ @Test
+ public void testColumnLocalDictionaryGeneratorWithValidDataWithinThreshold() {
+ LocalDictionaryGenerator generator = new ColumnLocalDictionaryGenerator(1000);
--- End diff --
@ravipesala @akashrn5 The constructor ColumnLocalDictionaryGenerator(int) has been modified to constructor ColumnLocalDictionaryGenerator(int, int), please update these issues.
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5344/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5409/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5429/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5504/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198440267
--- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
@@ -3041,24 +3041,30 @@ public static String getBlockId(AbsoluteTableIdentifier identifier, String fileP
* @param mainTableProperties
*/
public static void setLocalDictColumnsToWrapperSchema(List<ColumnSchema> columns,
- Map<String, String> mainTableProperties) {
- String isLocalDictEnabledForMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_ENABLE);
- String localDictIncludeColumnsOfMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_INCLUDE);
- String localDictExcludeColumnsOfMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_EXCLUDE);
+ Map<String, String> mainTableProperties, String isLocalDictEnabledForMainTable) {
String[] listOfDictionaryIncludeColumns = null;
String[] listOfDictionaryExcludeColumns = null;
+ String localDictIncludeColumns =
+ mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_INCLUDE);
+ String localDictExcludeColumns =
+ mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_EXCLUDE);
+ if (null != localDictIncludeColumns) {
+ listOfDictionaryIncludeColumns = localDictIncludeColumns.trim().split("\\s*,\\s*");
--- End diff --
what is this split required for?
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6590/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5477/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6481/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198441455
--- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
@@ -3041,24 +3041,30 @@ public static String getBlockId(AbsoluteTableIdentifier identifier, String fileP
* @param mainTableProperties
*/
public static void setLocalDictColumnsToWrapperSchema(List<ColumnSchema> columns,
- Map<String, String> mainTableProperties) {
- String isLocalDictEnabledForMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_ENABLE);
- String localDictIncludeColumnsOfMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_INCLUDE);
- String localDictExcludeColumnsOfMainTable =
- mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_EXCLUDE);
+ Map<String, String> mainTableProperties, String isLocalDictEnabledForMainTable) {
String[] listOfDictionaryIncludeColumns = null;
String[] listOfDictionaryExcludeColumns = null;
+ String localDictIncludeColumns =
+ mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_INCLUDE);
+ String localDictExcludeColumns =
+ mainTableProperties.get(CarbonCommonConstants.LOCAL_DICTIONARY_EXCLUDE);
+ if (null != localDictIncludeColumns) {
+ listOfDictionaryIncludeColumns = localDictIncludeColumns.trim().split("\\s*,\\s*");
--- End diff --
if user gives comma seperated values with empty spaces, need to trim it and then check validate the column
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6633/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198441426
--- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala ---
@@ -615,4 +618,114 @@ object CarbonScalaUtil {
sparkSession,
schema)._1.asInstanceOf[Object]
}
+
+ /**
+ * this method validates the local dictionary columns configurations
+ *
+ * @param tableProperties
+ * @param localDictColumns
+ */
+ def validateLocalDictionaryColumns(tableProperties: mutable.Map[String, String],
+ localDictColumns: Seq[String]): Unit = {
+ var dictIncludeColumns: Seq[String] = Seq[String]()
+
+ // check if the duplicate columns are specified in table schema
+ if (localDictColumns.distinct.lengthCompare(localDictColumns.size) != 0) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
--- End diff --
why adding empty Seq here?
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on the issue:
https://github.com/apache/carbondata/pull/2401
retest sdv please
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5403/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198443925
--- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala ---
@@ -615,4 +618,114 @@ object CarbonScalaUtil {
sparkSession,
schema)._1.asInstanceOf[Object]
}
+
+ /**
+ * this method validates the local dictionary columns configurations
+ *
+ * @param tableProperties
+ * @param localDictColumns
+ */
+ def validateLocalDictionaryColumns(tableProperties: mutable.Map[String, String],
+ localDictColumns: Seq[String]): Unit = {
+ var dictIncludeColumns: Seq[String] = Seq[String]()
+
+ // check if the duplicate columns are specified in table schema
+ if (localDictColumns.distinct.lengthCompare(localDictColumns.size) != 0) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
+ .diff((dictIncludeColumns ++ localDictColumns).distinct).distinct
+ val errMsg =
+ "LOCAL_DICTIONARY_INCLUDE/LOCAL_DICTIONARY_EXCLUDE contains Duplicate Columns: " +
+ duplicateColumns.mkString(",") +
+ ". Please check create table statement."
+ throw new MalformedCarbonCommandException(errMsg)
+ }
+
+ // check if the same column is present in both dictionary include and local dictionary columns
+ // configuration
+ if (tableProperties.get(CarbonCommonConstants.DICTIONARY_INCLUDE).isDefined) {
+ dictIncludeColumns =
+ tableProperties(CarbonCommonConstants.DICTIONARY_INCLUDE).split(",").map(_.trim)
+ localDictColumns.foreach { distCol =>
+ if (dictIncludeColumns.exists(x => x.equalsIgnoreCase(distCol.trim))) {
+ val duplicateColumns = (dictIncludeColumns ++ localDictColumns)
+ .diff((dictIncludeColumns ++ localDictColumns).distinct).distinct
--- End diff --
basically, the variable name should be changed to common column, i will change that, functionally it is getting the common column
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198436867
--- Diff: core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java ---
@@ -1110,9 +1110,18 @@ private static void setLocalDictInfo(CarbonTable table, TableInfo tableInfo) {
String localDictionaryThreshold = tableInfo.getFactTable().getTableProperties()
.get(CarbonCommonConstants.LOCAL_DICTIONARY_THRESHOLD);
if (null != isLocalDictionaryEnabled) {
- table.setLocalDictionaryEnabled(Boolean.parseBoolean(isLocalDictionaryEnabled));
+ // if table is altered then, for same key in table properties, multiple values will be
+ // appended, so after splitting, get the first value for enable and threshold, and that will
+ // be latest configurations for the table for further local dictionary generation, because for
+ // alter table add operation, local dictionary enable and threshold configuration is not
+ // allowed
+ String[] isLocalDictEnabled = isLocalDictionaryEnabled.split(",");
--- End diff --
Please don't handle the default property here. Better handle in parser like don't add default values if the flow through alter
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by akashrn5 <gi...@git.apache.org>.
Github user akashrn5 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r199112881
--- Diff: core/src/test/java/org/apache/carbondata/core/localdictionary/TestLocalDictionaryGenerator.java ---
@@ -0,0 +1,72 @@
+/*
+ * 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.localdictionary;
+
+import java.util.Arrays;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.localdictionary.exception.DictionaryThresholdReachedException;
+import org.apache.carbondata.core.localdictionary.generator.ColumnLocalDictionaryGenerator;
+import org.apache.carbondata.core.localdictionary.generator.LocalDictionaryGenerator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestLocalDictionaryGenerator {
+
+ @Test
+ public void testColumnLocalDictionaryGeneratorWithValidDataWithinThreshold() {
+ LocalDictionaryGenerator generator = new ColumnLocalDictionaryGenerator(1000);
--- End diff --
@zzcclp pr is raised #2428
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2401
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6512/
---
[GitHub] carbondata pull request #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dict...
Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2401#discussion_r198389740
--- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
@@ -3067,44 +3067,56 @@ public static void setLocalDictColumnsToWrapperSchema(List<ColumnSchema> columns
}
// if complex column is defined in local dictionary include column, then get the child
// columns and set the string datatype child type as local dictionary column
- if (column.getNumberOfChild() > 0 && null != localDictIncludeColumnsOfMainTable) {
- listOfDictionaryIncludeColumns = localDictIncludeColumnsOfMainTable.split(",");
+ if (column.getNumberOfChild() > 0 && null != localDictIncludeColumns) {
+ listOfDictionaryIncludeColumns = localDictIncludeColumns.trim().split("\\s*,\\s*");
--- End diff --
If possible move trim and split outside of loop as it output will be same and it is happening in loop which will impact the performance.
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5483/
---
[GitHub] carbondata issue #2401: [CARBONDATA-2585][CARBONDATA-2586][Local Dictionary]...
Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2401
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5510/
---