carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject incubator-carbondata git commit: Fixed null and not null in sub queries
Date Mon, 07 Nov 2016 15:02:42 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/branch-0.2 e0261831d -> b1d87672d


Fixed null and not null in sub queries


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

Branch: refs/heads/branch-0.2
Commit: b1d87672d6c442e422927e7eb416079e1c8010ef
Parents: e026183
Author: ravipesala <ravi.pesala@gmail.com>
Authored: Mon Nov 7 09:41:10 2016 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Mon Nov 7 20:32:01 2016 +0530

----------------------------------------------------------------------
 .../org/apache/carbondata/spark/CarbonFilters.scala   |  4 ++--
 .../testsuite/bigdecimal/TestNullAndEmptyFields.scala | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b1d87672/integration/spark/src/main/scala/org/apache/carbondata/spark/CarbonFilters.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/carbondata/spark/CarbonFilters.scala
b/integration/spark/src/main/scala/org/apache/carbondata/spark/CarbonFilters.scala
index 03c6053..711c51c 100644
--- a/integration/spark/src/main/scala/org/apache/carbondata/spark/CarbonFilters.scala
+++ b/integration/spark/src/main/scala/org/apache/carbondata/spark/CarbonFilters.scala
@@ -258,10 +258,10 @@ object CarbonFilters {
             Some(new NotEqualsExpression(transformExpression(a).get, transformExpression(l).get))
         case Not(EqualTo(l@Literal(v, t), Cast(a: Attribute, _))) => new
             Some(new NotEqualsExpression(transformExpression(a).get, transformExpression(l).get))
-        case IsNotNull(child) =>
+        case IsNotNull(child: Attribute) =>
             Some(new NotEqualsExpression(transformExpression(child).get,
              transformExpression(Literal(null)).get, true))
-        case IsNull(child) =>
+        case IsNull(child: Attribute) =>
             Some(new EqualToExpression(transformExpression(child).get,
              transformExpression(Literal(null)).get, true))
         case Not(In(a: Attribute, list))

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b1d87672/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/bigdecimal/TestNullAndEmptyFields.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/bigdecimal/TestNullAndEmptyFields.scala
b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/bigdecimal/TestNullAndEmptyFields.scala
index 1e82edf..85d6f85 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/bigdecimal/TestNullAndEmptyFields.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/bigdecimal/TestNullAndEmptyFields.scala
@@ -99,6 +99,20 @@ class TestNullAndEmptyFields extends QueryTest with BeforeAndAfterAll {
     )
   }
 
+  test("test  subquery on column having null values") {
+    checkAnswer(
+      sql("select * from (select if(country='china','c', country) test from carbonTable)qq
where test is null"),
+      sql("select * from (select if(country='china','c', country) test from hiveTable)qq
where test is null")
+    )
+  }
+
+  test("test  subquery on column having not null values") {
+    checkAnswer(
+      sql("select * from (select if(country='china','c', country) test from carbonTable)qq
where test is not null"),
+      sql("select * from (select if(country='china','c', country) test from hiveTable)qq
where test is not null")
+    )
+  }
+
   override def afterAll {
     sql("drop table if exists carbonTable")
     sql("drop table if exists hiveTable")


Mime
View raw message