Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8BA20200CF8 for ; Thu, 14 Sep 2017 11:19:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8A93D1609E9; Thu, 14 Sep 2017 09:19:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3F43E1609EC for ; Thu, 14 Sep 2017 11:19:57 +0200 (CEST) Received: (qmail 6992 invoked by uid 500); 14 Sep 2017 09:19:56 -0000 Mailing-List: contact commits-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list commits@carbondata.apache.org Received: (qmail 6629 invoked by uid 99); 14 Sep 2017 09:19:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 09:19:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 56B01F5839; Thu, 14 Sep 2017 09:19:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jackylk@apache.org To: commits@carbondata.apache.org Date: Thu, 14 Sep 2017 09:20:19 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [26/54] [abbrv] carbondata git commit: [CARBONDATA-1456]Regenerate cached hive results if cluster testcases fail archived-at: Thu, 14 Sep 2017 09:19:58 -0000 [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/streaming_ingest Commit: 0ebdc94cf630b54605f38443572217bbde493ae5 Parents: 2d75c46 Author: sraghunandan Authored: Wed Sep 6 15:09:44 2017 +0530 Committer: Ravindra Pesala 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 @@ true - GMT ${spark.master.url} ${hdfs.url} 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) }