Repository: spark
Updated Branches:
  refs/heads/master db56f2df1 -> cd273a238


http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-52-de3c42ab06c17ae895fd7deaf7bd9571
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-52-de3c42ab06c17ae895fd7deaf7bd9571
 
b/sql/hive/src/test/resources/golden/timestamp_2-52-de3c42ab06c17ae895fd7deaf7bd9571
new file mode 100644
index 0000000..211a320
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-52-de3c42ab06c17ae895fd7deaf7bd9571
@@ -0,0 +1 @@
+1293872461

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-53-da3937d21b7c2cfe1e624e812ae1d3ef
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-53-da3937d21b7c2cfe1e624e812ae1d3ef
 
b/sql/hive/src/test/resources/golden/timestamp_2-53-da3937d21b7c2cfe1e624e812ae1d3ef
new file mode 100644
index 0000000..211a320
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-53-da3937d21b7c2cfe1e624e812ae1d3ef
@@ -0,0 +1 @@
+1293872461

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-54-252aebfe7882335d31bfc53a8705b7a
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-54-252aebfe7882335d31bfc53a8705b7a
 
b/sql/hive/src/test/resources/golden/timestamp_2-54-252aebfe7882335d31bfc53a8705b7a
new file mode 100644
index 0000000..502f94a
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-54-252aebfe7882335d31bfc53a8705b7a
@@ -0,0 +1 @@
+1.29387251E9

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-55-5181279a0bf8939fe46ddacae015dad8
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-55-5181279a0bf8939fe46ddacae015dad8
 
b/sql/hive/src/test/resources/golden/timestamp_2-55-5181279a0bf8939fe46ddacae015dad8
new file mode 100644
index 0000000..3eefb34
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-55-5181279a0bf8939fe46ddacae015dad8
@@ -0,0 +1 @@
+1.293872461001E9

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-56-240fce5f58794fa051824e8732c00c03
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-56-240fce5f58794fa051824e8732c00c03
 
b/sql/hive/src/test/resources/golden/timestamp_2-56-240fce5f58794fa051824e8732c00c03
new file mode 100644
index 0000000..acce9d9
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-56-240fce5f58794fa051824e8732c00c03
@@ -0,0 +1 @@
+2011-01-01 01:01:01.001000011

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-57-ea7192a4a5a985bcc8aab9aa79d9f028
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-57-ea7192a4a5a985bcc8aab9aa79d9f028
 
b/sql/hive/src/test/resources/golden/timestamp_2-57-ea7192a4a5a985bcc8aab9aa79d9f028
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-6-5bdbf67419cc060b82d091d80ce59bf9
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-6-5bdbf67419cc060b82d091d80ce59bf9
 
b/sql/hive/src/test/resources/golden/timestamp_2-6-5bdbf67419cc060b82d091d80ce59bf9
new file mode 100644
index 0000000..8f3a494
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-6-5bdbf67419cc060b82d091d80ce59bf9
@@ -0,0 +1 @@
+-4787

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-7-de3c42ab06c17ae895fd7deaf7bd9571
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-7-de3c42ab06c17ae895fd7deaf7bd9571
 
b/sql/hive/src/test/resources/golden/timestamp_2-7-de3c42ab06c17ae895fd7deaf7bd9571
new file mode 100644
index 0000000..211a320
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-7-de3c42ab06c17ae895fd7deaf7bd9571
@@ -0,0 +1 @@
+1293872461

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-8-da3937d21b7c2cfe1e624e812ae1d3ef
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-8-da3937d21b7c2cfe1e624e812ae1d3ef
 
b/sql/hive/src/test/resources/golden/timestamp_2-8-da3937d21b7c2cfe1e624e812ae1d3ef
new file mode 100644
index 0000000..211a320
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-8-da3937d21b7c2cfe1e624e812ae1d3ef
@@ -0,0 +1 @@
+1293872461

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_2-9-252aebfe7882335d31bfc53a8705b7a
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_2-9-252aebfe7882335d31bfc53a8705b7a
 
b/sql/hive/src/test/resources/golden/timestamp_2-9-252aebfe7882335d31bfc53a8705b7a
new file mode 100644
index 0000000..502f94a
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_2-9-252aebfe7882335d31bfc53a8705b7a
@@ -0,0 +1 @@
+1.29387251E9

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_lazy-2-cdb72e0c24fd9277a41fe0c7b1392e34
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_lazy-2-cdb72e0c24fd9277a41fe0c7b1392e34
 
b/sql/hive/src/test/resources/golden/timestamp_lazy-2-cdb72e0c24fd9277a41fe0c7b1392e34
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_lazy-3-79e0c72c4fb3b259dfbffd245ccaa636
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_lazy-3-79e0c72c4fb3b259dfbffd245ccaa636
 
b/sql/hive/src/test/resources/golden/timestamp_lazy-3-79e0c72c4fb3b259dfbffd245ccaa636
new file mode 100644
index 0000000..e6bfe0b
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_lazy-3-79e0c72c4fb3b259dfbffd245ccaa636
@@ -0,0 +1,5 @@
+2011-01-01 01:01:01    165     val_165
+2011-01-01 01:01:01    238     val_238
+2011-01-01 01:01:01    27      val_27
+2011-01-01 01:01:01    311     val_311
+2011-01-01 01:01:01    86      val_86

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/timestamp_lazy-4-b4c4417ce9f08baeb82ffde6ef1baa25
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/timestamp_lazy-4-b4c4417ce9f08baeb82ffde6ef1baa25
 
b/sql/hive/src/test/resources/golden/timestamp_lazy-4-b4c4417ce9f08baeb82ffde6ef1baa25
new file mode 100644
index 0000000..e6bfe0b
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/timestamp_lazy-4-b4c4417ce9f08baeb82ffde6ef1baa25
@@ -0,0 +1,5 @@
+2011-01-01 01:01:01    165     val_165
+2011-01-01 01:01:01    238     val_238
+2011-01-01 01:01:01    27      val_27
+2011-01-01 01:01:01    311     val_311
+2011-01-01 01:01:01    86      val_86

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-0-d555c8cd733572bfa8cd3362da9480cb
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-0-d555c8cd733572bfa8cd3362da9480cb
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-0-d555c8cd733572bfa8cd3362da9480cb
new file mode 100644
index 0000000..9913d42
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-0-d555c8cd733572bfa8cd3362da9480cb
@@ -0,0 +1 @@
+unix_timestamp([date[, pattern]]) - Returns the UNIX timestamp

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-1-8a9dbadae706047715cf5f903ff4a724
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-1-8a9dbadae706047715cf5f903ff4a724
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-1-8a9dbadae706047715cf5f903ff4a724
new file mode 100644
index 0000000..ef4aa8e
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-1-8a9dbadae706047715cf5f903ff4a724
@@ -0,0 +1,2 @@
+unix_timestamp([date[, pattern]]) - Returns the UNIX timestamp
+Converts the current or specified time to number of seconds since 1970-01-01.

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-2-28c40e51e55bed62693e626efda5d9c5
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-2-28c40e51e55bed62693e626efda5d9c5
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-2-28c40e51e55bed62693e626efda5d9c5
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-3-732b21d386f2002b87eaf02d0b9951ed
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-3-732b21d386f2002b87eaf02d0b9951ed
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-3-732b21d386f2002b87eaf02d0b9951ed
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-4-b2e42ebb75cecf09961d36587797f6d0
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-4-b2e42ebb75cecf09961d36587797f6d0
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-4-b2e42ebb75cecf09961d36587797f6d0
new file mode 100644
index 0000000..31aaa95
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-4-b2e42ebb75cecf09961d36587797f6d0
@@ -0,0 +1 @@
+2009-03-20 11:30:01    1237573801

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-5-31243f5cb64356425b9f95ba011ac9d6
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-5-31243f5cb64356425b9f95ba011ac9d6
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-5-31243f5cb64356425b9f95ba011ac9d6
new file mode 100644
index 0000000..6d9ee69
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-5-31243f5cb64356425b9f95ba011ac9d6
@@ -0,0 +1 @@
+2009-03-20     1237532400

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-6-9b0f20bde1aaf9102b67a5498b167f31
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-6-9b0f20bde1aaf9102b67a5498b167f31
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-6-9b0f20bde1aaf9102b67a5498b167f31
new file mode 100644
index 0000000..e1d0cbb
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-6-9b0f20bde1aaf9102b67a5498b167f31
@@ -0,0 +1 @@
+2009 Mar 20 11:30:01 am        1237573801

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/resources/golden/udf_unix_timestamp-7-47f433ff6ccce4c666440cc1a228a96d
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/resources/golden/udf_unix_timestamp-7-47f433ff6ccce4c666440cc1a228a96d
 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-7-47f433ff6ccce4c666440cc1a228a96d
new file mode 100644
index 0000000..6b40e68
--- /dev/null
+++ 
b/sql/hive/src/test/resources/golden/udf_unix_timestamp-7-47f433ff6ccce4c666440cc1a228a96d
@@ -0,0 +1 @@
+random_string  NULL

http://git-wip-us.apache.org/repos/asf/spark/blob/cd273a23/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
index 63dbe57..fd44325 100644
--- 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
+++ 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
@@ -18,6 +18,7 @@
 package org.apache.spark.sql.hive.execution
 
 import java.io.File
+import java.util.TimeZone
 
 import org.scalatest.BeforeAndAfter
 
@@ -31,14 +32,20 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with 
BeforeAndAfter {
   lazy val hiveQueryDir = TestHive.getHiveFile("ql" + File.separator + "src" +
     File.separator + "test" + File.separator + "queries" + File.separator + 
"clientpositive")
 
+  var originalTimeZone: TimeZone = _
+
   def testCases = hiveQueryDir.listFiles.map(f => f.getName.stripSuffix(".q") 
-> f)
 
   override def beforeAll() {
     TestHive.cacheTables = true
+    // Timezone is fixed to America/Los_Angeles for those timezone sensitive 
tests (timestamp_*)
+    originalTimeZone = TimeZone.getDefault
+    TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
   }
 
   override def afterAll() {
     TestHive.cacheTables = false
+    TimeZone.setDefault(originalTimeZone)
   }
 
   /** A list of tests deemed out of scope currently and thus completely 
disregarded. */
@@ -92,8 +99,8 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with 
BeforeAndAfter {
     "create_view_translate",
     "partitions_json",
 
-    // Timezone specific test answers.
-    "udf_unix_timestamp",
+    // This test is totally fine except that it includes wrong queries and 
expects errors, but error
+    // message format in Hive and Spark SQL differ. Should workaround this 
later.
     "udf_to_unix_timestamp",
 
     // Cant run without local map/reduce.
@@ -659,8 +666,11 @@ class HiveCompatibilitySuite extends HiveQueryFileTest 
with BeforeAndAfter {
     "stats_publisher_error_1",
     "subq2",
     "tablename_with_select",
+    "timestamp_1",
+    "timestamp_2",
     "timestamp_3",
     "timestamp_comparison",
+    "timestamp_lazy",
     "timestamp_null",
     "timestamp_udf",
     "touch",
@@ -802,6 +812,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with 
BeforeAndAfter {
     "udf_translate",
     "udf_trim",
     "udf_ucase",
+    "udf_unix_timestamp",
     "udf_upper",
     "udf_var_pop",
     "udf_var_samp",

Reply via email to