carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject carbondata git commit: [CARBONDATA-1456]Regenerate cached hive results if cluster testcases fail
Date Sat, 09 Sep 2017 05:34:17 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 2d75c4661 -> 0ebdc94cf


[CARBONDATA-1456]Regenerate cached hive results if cluster testcases fail

This closes #1332


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

Branch: refs/heads/master
Commit: 0ebdc94cf630b54605f38443572217bbde493ae5
Parents: 2d75c46
Author: sraghunandan <carbondatacontributions@gmail.com>
Authored: Wed Sep 6 15:09:44 2017 +0530
Committer: Ravindra Pesala <ravi.pesala@gmail.com>
Committed: Sat Sep 9 11:03:46 2017 +0530

----------------------------------------------------------------------
 integration/spark-common-cluster-test/pom.xml   |  1 -
 .../spark/sql/common/util/QueryTest.scala       | 32 +++++++++++++-------
 2 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/0ebdc94c/integration/spark-common-cluster-test/pom.xml
----------------------------------------------------------------------
diff --git a/integration/spark-common-cluster-test/pom.xml b/integration/spark-common-cluster-test/pom.xml
index 935e55b..0f71653 100644
--- a/integration/spark-common-cluster-test/pom.xml
+++ b/integration/spark-common-cluster-test/pom.xml
@@ -143,7 +143,6 @@
           </environmentVariables>
           <systemProperties>
             <java.awt.headless>true</java.awt.headless>
-            <user.timezone>GMT</user.timezone>
             <spark.master.url>${spark.master.url}</spark.master.url>
             <hdfs.url>${hdfs.url}</hdfs.url>
           </systemProperties>

http://git-wip-us.apache.org/repos/asf/carbondata/blob/0ebdc94c/integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
b/integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
index 7c78b10..0c04b5e 100644
--- a/integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
+++ b/integration/spark-common-cluster-test/src/test/scala/org/apache/spark/sql/common/util/QueryTest.scala
@@ -40,8 +40,6 @@ class QueryTest extends PlanTest with Suite {
 
   val DOLLAR = "$"
 
-  // Timezone is fixed to America/Los_Angeles for those timezone sensitive tests (timestamp_*)
-  TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
   // Add Locale setting
   Locale.setDefault(Locale.US)
 
@@ -84,22 +82,34 @@ class QueryTest extends PlanTest with Suite {
     checkAnswer(df, expectedAnswer.collect())
   }
 
-  protected def checkAnswer(carbon: String, hive: String, uniqueIdentifier:String): Unit
= {
-    val path = TestQueryExecutor.hiveresultpath + "/"+uniqueIdentifier
+  protected def checkAnswer(carbon: String, hive: String, uniqueIdentifier: String): Unit
= {
+    val path = TestQueryExecutor.hiveresultpath + "/" + uniqueIdentifier
     if (FileFactory.isFileExist(path, FileFactory.getFileType(path))) {
-      val objinp = new ObjectInputStream(FileFactory.getDataInputStream(path, FileFactory.getFileType(path)))
+      val objinp = new ObjectInputStream(FileFactory
+        .getDataInputStream(path, FileFactory.getFileType(path)))
       val rows = objinp.readObject().asInstanceOf[Array[Row]]
       objinp.close()
-      checkAnswer(sql(carbon), rows)
+      QueryTest.checkAnswer(sql(carbon), rows) match {
+        case Some(errorMessage) => {
+          FileFactory.deleteFile(path, FileFactory.getFileType(path))
+          writeAndCheckAnswer(carbon, hive, path)
+        }
+        case None =>
+      }
     } else {
-      val rows = sql(hive).collect()
-      val obj = new ObjectOutputStream(FileFactory.getDataOutputStream(path, FileFactory.getFileType(path)))
-      obj.writeObject(rows)
-      obj.close()
-      checkAnswer(sql(carbon), rows)
+      writeAndCheckAnswer(carbon, hive, path)
     }
   }
 
+  private def writeAndCheckAnswer(carbon: String, hive: String, path: String): Unit = {
+    val rows = sql(hive).collect()
+    val obj = new ObjectOutputStream(FileFactory.getDataOutputStream(path, FileFactory
+      .getFileType(path)))
+    obj.writeObject(rows)
+    obj.close()
+    checkAnswer(sql(carbon), rows)
+  }
+
   protected def checkAnswer(carbon: String, expectedAnswer: Seq[Row], uniqueIdentifier:String):
Unit = {
     checkAnswer(sql(carbon), expectedAnswer)
   }


Mime
View raw message