You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2016/07/07 08:08:53 UTC

[1/2] incubator-carbondata git commit: add testcase for no inverted index

Repository: incubator-carbondata
Updated Branches:
  refs/heads/master d94cf2eb3 -> ea890a4f2


add testcase for no inverted index


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

Branch: refs/heads/master
Commit: d906cc7548ba9ff4a0c1527f92f589d946ef3391
Parents: d94cf2e
Author: Zhangshunyu <zh...@huawei.com>
Authored: Wed Jul 6 14:38:54 2016 +0800
Committer: chenliang613 <ch...@apache.org>
Committed: Thu Jul 7 13:37:19 2016 +0530

----------------------------------------------------------------------
 .../TestNoInvertedIndexLoadAndQuery.scala       | 53 +++++++++++++++++---
 1 file changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/d906cc75/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataload/TestNoInvertedIndexLoadAndQuery.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataload/TestNoInvertedIndexLoadAndQuery.scala b/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataload/TestNoInvertedIndexLoadAndQuery.scala
index 44f505d..df7ac8f 100644
--- a/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataload/TestNoInvertedIndexLoadAndQuery.scala
+++ b/integration/spark/src/test/scala/org/carbondata/spark/testsuite/dataload/TestNoInvertedIndexLoadAndQuery.scala
@@ -24,6 +24,9 @@ import java.io.File
 import org.apache.spark.sql.common.util.CarbonHiveContext._
 import org.apache.spark.sql.common.util.QueryTest
 import org.apache.spark.sql.Row
+
+import org.carbondata.core.util.CarbonProperties
+import org.carbondata.core.constants.CarbonCommonConstants
 import org.scalatest.BeforeAndAfterAll
 
 /**
@@ -35,32 +38,68 @@ class TestNoInvertedIndexLoadAndQuery extends QueryTest with BeforeAndAfterAll{
 
   def currentPath: String = new File(this.getClass.getResource("/").getPath + "/../../")
     .getCanonicalPath
-  val testData = new File(currentPath + "/../../examples/src/main/resources/dimSample.csv")
+  val testData1 = new File(currentPath + "/../../examples/src/main/resources/dimSample.csv")
+    .getCanonicalPath
+  val testData2 = new File(currentPath + "/../../examples/src/main/resources/data.csv")
     .getCanonicalPath
+
   override def beforeAll {
-    sql("DROP TABLE IF EXISTS index")
+    sql("DROP TABLE IF EXISTS index1")
+    sql("DROP TABLE IF EXISTS index2")
   }
 
-  test("no inverted index load and query") {
+  test("no inverted index load and point query") {
 
     sql("""
-           CREATE TABLE IF NOT EXISTS index
+           CREATE TABLE IF NOT EXISTS index1
            (id Int, name String, city String)
            STORED BY 'org.apache.carbondata.format'
            TBLPROPERTIES('NO_INVERTED_INDEX'='name,city')
            """)
     sql(s"""
-           LOAD DATA LOCAL INPATH '$testData' into table index
+           LOAD DATA LOCAL INPATH '$testData1' into table index1
            """)
     checkAnswer(
       sql("""
-           SELECT * FROM index WHERE city = "Bangalore"
+           SELECT * FROM index1 WHERE city = "Bangalore"
           """),
       Seq(Row("Emily", "Bangalore", 19.0)))
 
   }
 
+  test("no inverted index load and agg query") {
+
+    sql(
+      """
+        CREATE TABLE IF NOT EXISTS index2
+        (ID Int, date Timestamp, country String,
+        name String, phonetype String, serialname String, salary Int)
+        STORED BY 'org.apache.carbondata.format'
+        TBLPROPERTIES('NO_INVERTED_INDEX'='country,name,phonetype')
+      """)
+
+    CarbonProperties.getInstance()
+      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
+
+    sql(s"""
+           LOAD DATA LOCAL INPATH '$testData2' into table index2
+           """)
+
+    checkAnswer(
+      sql("""
+           SELECT country, count(salary) AS amount
+           FROM index2
+           WHERE country IN ('china','france')
+           GROUP BY country
+          """),
+      Seq(Row("china", 849), Row("france", 101))
+    )
+
+  }
+
   override def afterAll {
-    sql("drop table index")
+    sql("drop table index1")
+    sql("drop table index2")
   }
+
 }


[2/2] incubator-carbondata git commit: add testcase for no inverted index This closes #25

Posted by ch...@apache.org.
add testcase for no inverted index This closes #25


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

Branch: refs/heads/master
Commit: ea890a4f20a252daa963eb153da15668562eed68
Parents: d94cf2e d906cc7
Author: chenliang613 <ch...@apache.org>
Authored: Thu Jul 7 13:38:14 2016 +0530
Committer: chenliang613 <ch...@apache.org>
Committed: Thu Jul 7 13:38:14 2016 +0530

----------------------------------------------------------------------
 .../TestNoInvertedIndexLoadAndQuery.scala       | 53 +++++++++++++++++---
 1 file changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------