carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishgupt...@apache.org
Subject [1/2] carbondata git commit: Code Generator Error is thrown when Select filter contains more than one count of distinct of ComplexColumn with group by Clause
Date Fri, 06 Jul 2018 05:02:18 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 020335a8c -> 19a99e15e


Code Generator Error is thrown when Select filter contains more than one count of distinct
of ComplexColumn with group by Clause


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/cbecadfa
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/cbecadfa
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/cbecadfa

Branch: refs/heads/master
Commit: cbecadfad2408c18322e87aa5ac054d6d190d34c
Parents: 020335a
Author: Indhumathi27 <indhumathim27@gmail.com>
Authored: Tue Jul 3 22:31:40 2018 +0530
Committer: manishgupta88 <tomanishgupta18@gmail.com>
Committed: Fri Jul 6 10:34:47 2018 +0530

----------------------------------------------------------------------
 .../complexType/TestComplexDataType.scala       | 20 ++++++++++++++++++++
 .../sql/optimizer/CarbonLateDecodeRule.scala    |  7 ++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/cbecadfa/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
index 524289c..ba0dc66 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexDataType.scala
@@ -636,4 +636,24 @@ class TestComplexDataType extends QueryTest with BeforeAndAfterAll {
     sql("select b.c[0],a[0][0] from test").show(false)
   }
 
+  test("test structofarray with count(distinct)") {
+    sql("DROP TABLE IF EXISTS test")
+    CarbonProperties.getInstance()
+      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
+    sql(
+      "create table test(cus_id string, struct_of_array struct<id:int,date:timestamp,"
+
+      "sno:array<int>,sal:array<double>,state:array<string>,date1:array<timestamp>>)
stored by " +
+      "'carbondata'")
+    sql("insert into test values('cus_01','1$2017/01/01$1:2$2.0:3.0$ab:ac$2018/01/01')")
+    sql("select *from test").show(false)
+    sql(
+      "select struct_of_array.state[0],count(distinct struct_of_array.id) as count_int,count"
+
+      "(distinct struct_of_array.state[0]) as count_string from test group by struct_of_array"
+
+      ".state[0]")
+      .show(false)
+    CarbonProperties.getInstance()
+      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
+        CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/cbecadfa/integration/spark2/src/main/scala/org/apache/spark/sql/optimizer/CarbonLateDecodeRule.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/optimizer/CarbonLateDecodeRule.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/optimizer/CarbonLateDecodeRule.scala
index 7ed1705..68e7f07 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/optimizer/CarbonLateDecodeRule.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/optimizer/CarbonLateDecodeRule.scala
@@ -90,7 +90,12 @@ class CarbonLateDecodeRule extends Rule[LogicalPlan] with PredicateHelper
{
         LOGGER.info("skip CarbonOptimizer for scalar/predicate sub query")
         return false
       }
-      true
+      if(relations.exists(_.dictionaryMap.dictionaryMap.exists(_._2))) {
+        true
+      } else {
+        false
+      }
+
     } else {
       LOGGER.info("skip CarbonOptimizer")
       false


Mime
View raw message