Repository: spark
Updated Branches:
  refs/heads/branch-1.1 77116875f -> 5ea260ebd


[SPARK-3065][SQL] Add locale setting to fix results do not match for 
udf_unix_timestamp format "yyyy MMM dd h:mm:ss a" run with not 
"America/Los_Angeles" TimeZone in HiveCompatibilitySuite

When run the udf_unix_timestamp of 
org.apache.spark.sql.hive.execution.HiveCompatibilitySuite testcase
with not "America/Los_Angeles" TimeZone throws error. 
[https://issues.apache.org/jira/browse/SPARK-3065]
add locale setting on beforeAll and afterAll method to fix the bug of 
HiveCompatibilitySuite testcase

Author: luogankun <[email protected]>

Closes #1968 from luogankun/SPARK-3065 and squashes the following commits:

c167832 [luogankun] [SPARK-3065][SQL] Add Locale setting to 
HiveCompatibilitySuite
0a25e3a [luogankun] [SPARK-3065][SQL] Add Locale setting to 
HiveCompatibilitySuite

(cherry picked from commit 65253502b913f390b26b9b631380b2c6cf1ccdf7)
Signed-off-by: Michael Armbrust <[email protected]>


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

Branch: refs/heads/branch-1.1
Commit: 5ea260ebd1acbbe9705849a16ee67758e33c65b0
Parents: 7711687
Author: luogankun <[email protected]>
Authored: Wed Aug 27 15:08:22 2014 -0700
Committer: Michael Armbrust <[email protected]>
Committed: Wed Aug 27 15:08:34 2014 -0700

----------------------------------------------------------------------
 .../spark/sql/hive/execution/HiveCompatibilitySuite.scala    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/5ea260eb/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
 
b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
index 7a69e3c..035fd32 100644
--- 
a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
+++ 
b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
@@ -18,7 +18,7 @@
 package org.apache.spark.sql.hive.execution
 
 import java.io.File
-import java.util.TimeZone
+import java.util.{Locale, TimeZone}
 
 import org.scalatest.BeforeAndAfter
 
@@ -33,6 +33,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with 
BeforeAndAfter {
     File.separator + "test" + File.separator + "queries" + File.separator + 
"clientpositive")
 
   var originalTimeZone: TimeZone = _
+  var originalLocale: Locale = _
 
   def testCases = hiveQueryDir.listFiles.map(f => f.getName.stripSuffix(".q") 
-> f)
 
@@ -41,11 +42,16 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with 
BeforeAndAfter {
     // Timezone is fixed to America/Los_Angeles for those timezone sensitive 
tests (timestamp_*)
     originalTimeZone = TimeZone.getDefault
     TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
+    
+    // Add Locale setting
+    originalLocale = Locale.getDefault
+    Locale.setDefault(Locale.US)
   }
 
   override def afterAll() {
     TestHive.cacheTables = false
     TimeZone.setDefault(originalTimeZone)
+    Locale.setDefault(originalLocale)
   }
 
   /** A list of tests deemed out of scope currently and thus completely 
disregarded. */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to