You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2014/10/13 22:33:20 UTC

[1/2] [SPARK-3407][SQL]Add Date type support

Repository: spark
Updated Branches:
  refs/heads/master 46db277cc -> 2ac40da3f


http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-6-5606505a92bad10023ad9a3ef77eacc9
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-6-5606505a92bad10023ad9a3ef77eacc9 b/sql/hive/src/test/resources/golden/date_comparison-6-5606505a92bad10023ad9a3ef77eacc9
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-6-5606505a92bad10023ad9a3ef77eacc9
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-7-47913d4aaf0d468ab3764cc3bfd68eb
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-7-47913d4aaf0d468ab3764cc3bfd68eb b/sql/hive/src/test/resources/golden/date_comparison-7-47913d4aaf0d468ab3764cc3bfd68eb
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-7-47913d4aaf0d468ab3764cc3bfd68eb
@@ -0,0 +1 @@
+true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-8-1e5ce4f833b6fba45618437c8fb7643c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-8-1e5ce4f833b6fba45618437c8fb7643c b/sql/hive/src/test/resources/golden/date_comparison-8-1e5ce4f833b6fba45618437c8fb7643c
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-8-1e5ce4f833b6fba45618437c8fb7643c
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-9-bcd987341fc1c38047a27d29dac6ae7c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-9-bcd987341fc1c38047a27d29dac6ae7c b/sql/hive/src/test/resources/golden/date_comparison-9-bcd987341fc1c38047a27d29dac6ae7c
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-9-bcd987341fc1c38047a27d29dac6ae7c
@@ -0,0 +1 @@
+true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_join1-3-f71c7be760fb4de4eff8225f2c6614b2
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_join1-3-f71c7be760fb4de4eff8225f2c6614b2 b/sql/hive/src/test/resources/golden/date_join1-3-f71c7be760fb4de4eff8225f2c6614b2
new file mode 100644
index 0000000..b7305b9
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_join1-3-f71c7be760fb4de4eff8225f2c6614b2
@@ -0,0 +1,22 @@
+1064	2010-10-20	1064	2010-10-20
+1142	2010-10-21	1142	2010-10-21
+1599	2010-10-22	1599	2010-10-22
+361	2010-10-23	361	2010-10-23
+897	2010-10-24	897	2010-10-24
+1531	2010-10-25	1531	2010-10-25
+1610	2010-10-26	1610	2010-10-26
+3198	2010-10-27	3198	2010-10-27
+1064	2010-10-28	1064	2010-10-28
+1142	2010-10-29	1142	2010-10-29
+1064	2000-11-20	1064	2000-11-20
+1142	2000-11-21	1142	2000-11-21
+1599	2000-11-22	1599	2000-11-22
+361	2000-11-23	361	2000-11-23
+897	2000-11-24	897	2000-11-24
+1531	2000-11-25	1531	2000-11-25
+1610	2000-11-26	1610	2000-11-26
+3198	2000-11-27	3198	2000-11-27
+1064	2000-11-28	1064	2000-11-28
+1142	2000-11-28	1064	2000-11-28
+1064	2000-11-28	1142	2000-11-28
+1142	2000-11-28	1142	2000-11-28

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_join1-4-70b9b49c55699fe94cfde069f5d197c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_join1-4-70b9b49c55699fe94cfde069f5d197c b/sql/hive/src/test/resources/golden/date_join1-4-70b9b49c55699fe94cfde069f5d197c
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-11-29540200936bba47f17553547b409af7
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-11-29540200936bba47f17553547b409af7 b/sql/hive/src/test/resources/golden/date_serde-11-29540200936bba47f17553547b409af7
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-13-6c546456c81e635b6753e1552fac9129
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-13-6c546456c81e635b6753e1552fac9129 b/sql/hive/src/test/resources/golden/date_serde-13-6c546456c81e635b6753e1552fac9129
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-13-6c546456c81e635b6753e1552fac9129
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-14-f8ba18cc7b0225b4022299c44d435101
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-14-f8ba18cc7b0225b4022299c44d435101 b/sql/hive/src/test/resources/golden/date_serde-14-f8ba18cc7b0225b4022299c44d435101
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-14-f8ba18cc7b0225b4022299c44d435101
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-15-66fadc9bcea7d107a610758aa6f50ff3
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-15-66fadc9bcea7d107a610758aa6f50ff3 b/sql/hive/src/test/resources/golden/date_serde-15-66fadc9bcea7d107a610758aa6f50ff3
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-16-1bd3345b46f77e17810978e56f9f7c6b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-16-1bd3345b46f77e17810978e56f9f7c6b b/sql/hive/src/test/resources/golden/date_serde-16-1bd3345b46f77e17810978e56f9f7c6b
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-18-b50ecc72ce9018ab12fb17568fef038a
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-18-b50ecc72ce9018ab12fb17568fef038a b/sql/hive/src/test/resources/golden/date_serde-18-b50ecc72ce9018ab12fb17568fef038a
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-18-b50ecc72ce9018ab12fb17568fef038a
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-19-28f1cf92bdd6b2e5d328cd9d10f828b6
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-19-28f1cf92bdd6b2e5d328cd9d10f828b6 b/sql/hive/src/test/resources/golden/date_serde-19-28f1cf92bdd6b2e5d328cd9d10f828b6
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-19-28f1cf92bdd6b2e5d328cd9d10f828b6
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-20-588516368d8c1533cb7bfb2157fd58c1
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-20-588516368d8c1533cb7bfb2157fd58c1 b/sql/hive/src/test/resources/golden/date_serde-20-588516368d8c1533cb7bfb2157fd58c1
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-22-45240a488fb708e432d2f45b74ef7e63
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-22-45240a488fb708e432d2f45b74ef7e63 b/sql/hive/src/test/resources/golden/date_serde-22-45240a488fb708e432d2f45b74ef7e63
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-23-1742a51e4967a8d263572d890cd8d4a8
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-23-1742a51e4967a8d263572d890cd8d4a8 b/sql/hive/src/test/resources/golden/date_serde-23-1742a51e4967a8d263572d890cd8d4a8
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-23-1742a51e4967a8d263572d890cd8d4a8
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-24-14fd49bd6fee907c1699f7b4e26685b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-24-14fd49bd6fee907c1699f7b4e26685b b/sql/hive/src/test/resources/golden/date_serde-24-14fd49bd6fee907c1699f7b4e26685b
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-24-14fd49bd6fee907c1699f7b4e26685b
@@ -0,0 +1 @@
+2010-10-20	1064

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-27-4d86c79f858866acec3c37f6598c2638
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-27-4d86c79f858866acec3c37f6598c2638 b/sql/hive/src/test/resources/golden/date_serde-27-4d86c79f858866acec3c37f6598c2638
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-28-16a41fc9e0f51eb417c763bae8e9cadb
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-28-16a41fc9e0f51eb417c763bae8e9cadb b/sql/hive/src/test/resources/golden/date_serde-28-16a41fc9e0f51eb417c763bae8e9cadb
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-28-16a41fc9e0f51eb417c763bae8e9cadb
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-29-bd1cb09aacd906527b0bbf43bbded812
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-29-bd1cb09aacd906527b0bbf43bbded812 b/sql/hive/src/test/resources/golden/date_serde-29-bd1cb09aacd906527b0bbf43bbded812
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-29-bd1cb09aacd906527b0bbf43bbded812
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-30-7c80741f9f485729afc68609c55423a0
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-30-7c80741f9f485729afc68609c55423a0 b/sql/hive/src/test/resources/golden/date_serde-30-7c80741f9f485729afc68609c55423a0
new file mode 100644
index 0000000..e69de29

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-33-a742813b024e6dcfb4a358aa4e9fcdb6
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-33-a742813b024e6dcfb4a358aa4e9fcdb6 b/sql/hive/src/test/resources/golden/date_serde-33-a742813b024e6dcfb4a358aa4e9fcdb6
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-33-a742813b024e6dcfb4a358aa4e9fcdb6
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-34-6485841336c097895ad5b34f42c0745f
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-34-6485841336c097895ad5b34f42c0745f b/sql/hive/src/test/resources/golden/date_serde-34-6485841336c097895ad5b34f42c0745f
new file mode 100644
index 0000000..9f2238d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-34-6485841336c097895ad5b34f42c0745f
@@ -0,0 +1 @@
+2010-10-20	1064

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-35-8651a7c351cbc07fb1af6193f6885de8
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-35-8651a7c351cbc07fb1af6193f6885de8 b/sql/hive/src/test/resources/golden/date_serde-35-8651a7c351cbc07fb1af6193f6885de8
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-37-3ddfd8ecb28991aeed588f1ea852c427
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-37-3ddfd8ecb28991aeed588f1ea852c427 b/sql/hive/src/test/resources/golden/date_serde-37-3ddfd8ecb28991aeed588f1ea852c427
new file mode 100644
index 0000000..e69de29

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-40-4a17944b9ec8999bb20c5ba5d4cb877c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-40-4a17944b9ec8999bb20c5ba5d4cb877c b/sql/hive/src/test/resources/golden/date_serde-40-4a17944b9ec8999bb20c5ba5d4cb877c
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-8-cace4f60a08342f58fbe816a9c3a73cf
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-8-cace4f60a08342f58fbe816a9c3a73cf b/sql/hive/src/test/resources/golden/date_serde-8-cace4f60a08342f58fbe816a9c3a73cf
new file mode 100644
index 0000000..16c03e7
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-8-cace4f60a08342f58fbe816a9c3a73cf
@@ -0,0 +1,137 @@
+Baltimore	New York	2010-10-20	-30.0	1064
+Baltimore	New York	2010-10-20	23.0	1142
+Baltimore	New York	2010-10-20	6.0	1599
+Chicago	New York	2010-10-20	42.0	361
+Chicago	New York	2010-10-20	24.0	897
+Chicago	New York	2010-10-20	15.0	1531
+Chicago	New York	2010-10-20	-6.0	1610
+Chicago	New York	2010-10-20	-2.0	3198
+Baltimore	New York	2010-10-21	17.0	1064
+Baltimore	New York	2010-10-21	105.0	1142
+Baltimore	New York	2010-10-21	28.0	1599
+Chicago	New York	2010-10-21	142.0	361
+Chicago	New York	2010-10-21	77.0	897
+Chicago	New York	2010-10-21	53.0	1531
+Chicago	New York	2010-10-21	-5.0	1610
+Chicago	New York	2010-10-21	51.0	3198
+Baltimore	New York	2010-10-22	-12.0	1064
+Baltimore	New York	2010-10-22	54.0	1142
+Baltimore	New York	2010-10-22	18.0	1599
+Chicago	New York	2010-10-22	2.0	361
+Chicago	New York	2010-10-22	24.0	897
+Chicago	New York	2010-10-22	16.0	1531
+Chicago	New York	2010-10-22	-6.0	1610
+Chicago	New York	2010-10-22	-11.0	3198
+Baltimore	New York	2010-10-23	18.0	272
+Baltimore	New York	2010-10-23	-10.0	1805
+Baltimore	New York	2010-10-23	6.0	3171
+Chicago	New York	2010-10-23	3.0	384
+Chicago	New York	2010-10-23	32.0	426
+Chicago	New York	2010-10-23	1.0	650
+Chicago	New York	2010-10-23	11.0	3085
+Baltimore	New York	2010-10-24	12.0	1599
+Baltimore	New York	2010-10-24	20.0	2571
+Chicago	New York	2010-10-24	10.0	361
+Chicago	New York	2010-10-24	113.0	897
+Chicago	New York	2010-10-24	-5.0	1531
+Chicago	New York	2010-10-24	-17.0	1610
+Chicago	New York	2010-10-24	-3.0	3198
+Baltimore	New York	2010-10-25	-25.0	1064
+Baltimore	New York	2010-10-25	92.0	1142
+Baltimore	New York	2010-10-25	106.0	1599
+Chicago	New York	2010-10-25	31.0	361
+Chicago	New York	2010-10-25	-1.0	897
+Chicago	New York	2010-10-25	43.0	1531
+Chicago	New York	2010-10-25	6.0	1610
+Chicago	New York	2010-10-25	-16.0	3198
+Baltimore	New York	2010-10-26	-22.0	1064
+Baltimore	New York	2010-10-26	123.0	1142
+Baltimore	New York	2010-10-26	90.0	1599
+Chicago	New York	2010-10-26	12.0	361
+Chicago	New York	2010-10-26	0.0	897
+Chicago	New York	2010-10-26	29.0	1531
+Chicago	New York	2010-10-26	-17.0	1610
+Chicago	New York	2010-10-26	6.0	3198
+Baltimore	New York	2010-10-27	-18.0	1064
+Baltimore	New York	2010-10-27	49.0	1142
+Baltimore	New York	2010-10-27	92.0	1599
+Chicago	New York	2010-10-27	148.0	361
+Chicago	New York	2010-10-27	-11.0	897
+Chicago	New York	2010-10-27	70.0	1531
+Chicago	New York	2010-10-27	8.0	1610
+Chicago	New York	2010-10-27	21.0	3198
+Baltimore	New York	2010-10-28	-4.0	1064
+Baltimore	New York	2010-10-28	-14.0	1142
+Baltimore	New York	2010-10-28	-14.0	1599
+Chicago	New York	2010-10-28	2.0	361
+Chicago	New York	2010-10-28	2.0	897
+Chicago	New York	2010-10-28	-11.0	1531
+Chicago	New York	2010-10-28	3.0	1610
+Chicago	New York	2010-10-28	-18.0	3198
+Baltimore	New York	2010-10-29	-24.0	1064
+Baltimore	New York	2010-10-29	21.0	1142
+Baltimore	New York	2010-10-29	-2.0	1599
+Chicago	New York	2010-10-29	-12.0	361
+Chicago	New York	2010-10-29	-11.0	897
+Chicago	New York	2010-10-29	15.0	1531
+Chicago	New York	2010-10-29	-18.0	1610
+Chicago	New York	2010-10-29	-4.0	3198
+Baltimore	New York	2010-10-30	14.0	272
+Baltimore	New York	2010-10-30	-1.0	1805
+Baltimore	New York	2010-10-30	5.0	3171
+Chicago	New York	2010-10-30	-6.0	384
+Chicago	New York	2010-10-30	-10.0	426
+Chicago	New York	2010-10-30	-5.0	650
+Chicago	New York	2010-10-30	-5.0	3085
+Baltimore	New York	2010-10-31	-1.0	1599
+Baltimore	New York	2010-10-31	-14.0	2571
+Chicago	New York	2010-10-31	-25.0	361
+Chicago	New York	2010-10-31	-18.0	897
+Chicago	New York	2010-10-31	-4.0	1531
+Chicago	New York	2010-10-31	-22.0	1610
+Chicago	New York	2010-10-31	-15.0	3198
+Cleveland	New York	2010-10-30	-23.0	2018
+Cleveland	New York	2010-10-30	-12.0	2932
+Cleveland	New York	2010-10-29	-4.0	2630
+Cleveland	New York	2010-10-29	-19.0	2646
+Cleveland	New York	2010-10-29	-12.0	3014
+Cleveland	New York	2010-10-28	3.0	2630
+Cleveland	New York	2010-10-28	-6.0	2646
+Cleveland	New York	2010-10-28	1.0	3014
+Cleveland	New York	2010-10-27	16.0	2630
+Cleveland	New York	2010-10-27	27.0	3014
+Cleveland	New York	2010-10-26	4.0	2630
+Cleveland	New York	2010-10-26	-27.0	2646
+Cleveland	New York	2010-10-26	-11.0	2662
+Cleveland	New York	2010-10-26	13.0	3014
+Cleveland	New York	2010-10-25	-4.0	2630
+Cleveland	New York	2010-10-25	81.0	2646
+Cleveland	New York	2010-10-25	42.0	3014
+Cleveland	New York	2010-10-24	5.0	2254
+Cleveland	New York	2010-10-24	-11.0	2630
+Cleveland	New York	2010-10-24	-20.0	2646
+Cleveland	New York	2010-10-24	-9.0	3014
+Cleveland	New York	2010-10-23	-21.0	2932
+Cleveland	New York	2010-10-22	1.0	2630
+Cleveland	New York	2010-10-22	-25.0	2646
+Cleveland	New York	2010-10-22	-3.0	3014
+Cleveland	New York	2010-10-21	3.0	2630
+Cleveland	New York	2010-10-21	29.0	2646
+Cleveland	New York	2010-10-21	72.0	3014
+Cleveland	New York	2010-10-20	-8.0	2630
+Cleveland	New York	2010-10-20	-15.0	3014
+Washington	New York	2010-10-23	-25.0	5832
+Washington	New York	2010-10-23	-21.0	5904
+Washington	New York	2010-10-23	-18.0	5917
+Washington	New York	2010-10-30	-27.0	5904
+Washington	New York	2010-10-30	-16.0	5917
+Washington	New York	2010-10-20	-2.0	7291
+Washington	New York	2010-10-21	22.0	7291
+Washington	New York	2010-10-23	-16.0	7274
+Washington	New York	2010-10-24	-26.0	7282
+Washington	New York	2010-10-25	9.0	7291
+Washington	New York	2010-10-26	4.0	7291
+Washington	New York	2010-10-27	26.0	7291
+Washington	New York	2010-10-28	45.0	7291
+Washington	New York	2010-10-29	1.0	7291
+Washington	New York	2010-10-31	-18.0	7282

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_serde-9-436c3c61cc4278b54ac79c53c88ff422
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_serde-9-436c3c61cc4278b54ac79c53c88ff422 b/sql/hive/src/test/resources/golden/date_serde-9-436c3c61cc4278b54ac79c53c88ff422
new file mode 100644
index 0000000..0f2a6f7
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_serde-9-436c3c61cc4278b54ac79c53c88ff422
@@ -0,0 +1,12 @@
+2010-10-20	11
+2010-10-21	12
+2010-10-22	11
+2010-10-23	12
+2010-10-24	12
+2010-10-25	12
+2010-10-26	13
+2010-10-27	11
+2010-10-28	12
+2010-10-29	12
+2010-10-30	11
+2010-10-31	8

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-0-84604a42a5d7f2842f1eec10c689d447
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-0-84604a42a5d7f2842f1eec10c689d447 b/sql/hive/src/test/resources/golden/date_udf-0-84604a42a5d7f2842f1eec10c689d447
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-1-5e8136f6a6503ae9bef9beca80fada13
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-1-5e8136f6a6503ae9bef9beca80fada13 b/sql/hive/src/test/resources/golden/date_udf-1-5e8136f6a6503ae9bef9beca80fada13
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-10-988ad9744096a29a3672a2d4c121299b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-10-988ad9744096a29a3672a2d4c121299b b/sql/hive/src/test/resources/golden/date_udf-10-988ad9744096a29a3672a2d4c121299b
new file mode 100644
index 0000000..83c3340
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-10-988ad9744096a29a3672a2d4c121299b
@@ -0,0 +1 @@
+0	3333	-3333	-3332	3332

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-11-a5100dd42201b5bc035a9d684cc21bdc
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-11-a5100dd42201b5bc035a9d684cc21bdc b/sql/hive/src/test/resources/golden/date_udf-11-a5100dd42201b5bc035a9d684cc21bdc
new file mode 100644
index 0000000..4a2462b
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-11-a5100dd42201b5bc035a9d684cc21bdc
@@ -0,0 +1 @@
+NULL	2011	5	6	6	18	2011-05-06

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-12-eb7280a1f191344a99eaa0f805e8faff
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-12-eb7280a1f191344a99eaa0f805e8faff b/sql/hive/src/test/resources/golden/date_udf-12-eb7280a1f191344a99eaa0f805e8faff
new file mode 100644
index 0000000..1949725
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-12-eb7280a1f191344a99eaa0f805e8faff
@@ -0,0 +1 @@
+2011-05-11	2011-04-26

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-13-cc99e4f14fd092994b006ee7ebe4fc92
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-13-cc99e4f14fd092994b006ee7ebe4fc92 b/sql/hive/src/test/resources/golden/date_udf-13-cc99e4f14fd092994b006ee7ebe4fc92
new file mode 100644
index 0000000..977f0d2
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-13-cc99e4f14fd092994b006ee7ebe4fc92
@@ -0,0 +1 @@
+0	3333	-3333	-3333	3333

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-14-a6a5ce5134cc1125355a4bdf0a73d97
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-14-a6a5ce5134cc1125355a4bdf0a73d97 b/sql/hive/src/test/resources/golden/date_udf-14-a6a5ce5134cc1125355a4bdf0a73d97
new file mode 100644
index 0000000..44d1f45
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-14-a6a5ce5134cc1125355a4bdf0a73d97
@@ -0,0 +1 @@
+1970-01-01 08:00:00	1969-12-31 16:00:00	2013-06-19 07:00:00	2013-06-18 17:00:00

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-15-d031ee50c119d7c6acafd53543dbd0c4
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-15-d031ee50c119d7c6acafd53543dbd0c4 b/sql/hive/src/test/resources/golden/date_udf-15-d031ee50c119d7c6acafd53543dbd0c4
new file mode 100644
index 0000000..645b71d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-15-d031ee50c119d7c6acafd53543dbd0c4
@@ -0,0 +1 @@
+true	true	true	true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-16-dc59f69e1685e8d923b187ec50d80f06
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-16-dc59f69e1685e8d923b187ec50d80f06 b/sql/hive/src/test/resources/golden/date_udf-16-dc59f69e1685e8d923b187ec50d80f06
new file mode 100644
index 0000000..51863e9
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-16-dc59f69e1685e8d923b187ec50d80f06
@@ -0,0 +1 @@
+2010-10-20

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-17-7d046d4efc568049cf3792470b6feab9
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-17-7d046d4efc568049cf3792470b6feab9 b/sql/hive/src/test/resources/golden/date_udf-17-7d046d4efc568049cf3792470b6feab9
new file mode 100644
index 0000000..4043ee1
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-17-7d046d4efc568049cf3792470b6feab9
@@ -0,0 +1 @@
+2010-10-31

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-18-84604a42a5d7f2842f1eec10c689d447
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-18-84604a42a5d7f2842f1eec10c689d447 b/sql/hive/src/test/resources/golden/date_udf-18-84604a42a5d7f2842f1eec10c689d447
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-19-5e8136f6a6503ae9bef9beca80fada13
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-19-5e8136f6a6503ae9bef9beca80fada13 b/sql/hive/src/test/resources/golden/date_udf-19-5e8136f6a6503ae9bef9beca80fada13
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-20-10e337c34d1e82a360b8599988f4b266
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-20-10e337c34d1e82a360b8599988f4b266 b/sql/hive/src/test/resources/golden/date_udf-20-10e337c34d1e82a360b8599988f4b266
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-3-29e406e613c0284b3e16a8943a4d31bd
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-3-29e406e613c0284b3e16a8943a4d31bd b/sql/hive/src/test/resources/golden/date_udf-3-29e406e613c0284b3e16a8943a4d31bd
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-4-23653315213f578856ab5c3bd80c0264
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-4-23653315213f578856ab5c3bd80c0264 b/sql/hive/src/test/resources/golden/date_udf-4-23653315213f578856ab5c3bd80c0264
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-5-891fd92a4787b9789f6d1f51c1eddc8a
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-5-891fd92a4787b9789f6d1f51c1eddc8a b/sql/hive/src/test/resources/golden/date_udf-5-891fd92a4787b9789f6d1f51c1eddc8a
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-6-3473c118d20783eafb456043a2ee5d5b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-6-3473c118d20783eafb456043a2ee5d5b b/sql/hive/src/test/resources/golden/date_udf-6-3473c118d20783eafb456043a2ee5d5b
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-7-9fb5165824e161074565e7500959c1b2
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-7-9fb5165824e161074565e7500959c1b2 b/sql/hive/src/test/resources/golden/date_udf-7-9fb5165824e161074565e7500959c1b2
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-8-badfe833681362092fc6345f888b1c21
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-8-badfe833681362092fc6345f888b1c21 b/sql/hive/src/test/resources/golden/date_udf-8-badfe833681362092fc6345f888b1c21
new file mode 100644
index 0000000..18d17ea
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-8-badfe833681362092fc6345f888b1c21
@@ -0,0 +1 @@
+1304665200	2011	5	6	6	18	2011-05-06

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_udf-9-a8cbb039661d796beaa0d1564c58c563
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_udf-9-a8cbb039661d796beaa0d1564c58c563 b/sql/hive/src/test/resources/golden/date_udf-9-a8cbb039661d796beaa0d1564c58c563
new file mode 100644
index 0000000..1949725
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_udf-9-a8cbb039661d796beaa0d1564c58c563
@@ -0,0 +1 @@
+2011-05-11	2011-04-26

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-0-7ec1f3a845e2c49191460e15af30aa30
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-0-7ec1f3a845e2c49191460e15af30aa30 b/sql/hive/src/test/resources/golden/partition_date-0-7ec1f3a845e2c49191460e15af30aa30
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-1-916193405ce5e020dcd32c58325db6fe
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-1-916193405ce5e020dcd32c58325db6fe b/sql/hive/src/test/resources/golden/partition_date-1-916193405ce5e020dcd32c58325db6fe
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-10-a8dde9c0b5746dd770c9c262d23ffb10
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-10-a8dde9c0b5746dd770c9c262d23ffb10 b/sql/hive/src/test/resources/golden/partition_date-10-a8dde9c0b5746dd770c9c262d23ffb10
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-10-a8dde9c0b5746dd770c9c262d23ffb10
@@ -0,0 +1 @@
+5

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-11-fdface2fb6eef67f15bb7d0de2294957
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-11-fdface2fb6eef67f15bb7d0de2294957 b/sql/hive/src/test/resources/golden/partition_date-11-fdface2fb6eef67f15bb7d0de2294957
new file mode 100644
index 0000000..b4de394
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-11-fdface2fb6eef67f15bb7d0de2294957
@@ -0,0 +1 @@
+11

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-12-9b945f8ece6e09ad28c866ff3a10cc24
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-12-9b945f8ece6e09ad28c866ff3a10cc24 b/sql/hive/src/test/resources/golden/partition_date-12-9b945f8ece6e09ad28c866ff3a10cc24
new file mode 100644
index 0000000..64bb6b7
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-12-9b945f8ece6e09ad28c866ff3a10cc24
@@ -0,0 +1 @@
+30

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-13-b7cb91c7c459798078a79071d329dbf
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-13-b7cb91c7c459798078a79071d329dbf b/sql/hive/src/test/resources/golden/partition_date-13-b7cb91c7c459798078a79071d329dbf
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-13-b7cb91c7c459798078a79071d329dbf
@@ -0,0 +1 @@
+0

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-14-e4366325f3a0c4a8e92be59f4de73fce
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-14-e4366325f3a0c4a8e92be59f4de73fce b/sql/hive/src/test/resources/golden/partition_date-14-e4366325f3a0c4a8e92be59f4de73fce
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-14-e4366325f3a0c4a8e92be59f4de73fce
@@ -0,0 +1 @@
+0

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-15-a062a6e87867d8c8cfbdad97bedcbe5f
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-15-a062a6e87867d8c8cfbdad97bedcbe5f b/sql/hive/src/test/resources/golden/partition_date-15-a062a6e87867d8c8cfbdad97bedcbe5f
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-15-a062a6e87867d8c8cfbdad97bedcbe5f
@@ -0,0 +1 @@
+20

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-16-22a5627d9ac112665eae01d07a91c89c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-16-22a5627d9ac112665eae01d07a91c89c b/sql/hive/src/test/resources/golden/partition_date-16-22a5627d9ac112665eae01d07a91c89c
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-16-22a5627d9ac112665eae01d07a91c89c
@@ -0,0 +1 @@
+10

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-17-b9ce94ef93cb16d629af7d7f8ee637e
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-17-b9ce94ef93cb16d629af7d7f8ee637e b/sql/hive/src/test/resources/golden/partition_date-17-b9ce94ef93cb16d629af7d7f8ee637e
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-17-b9ce94ef93cb16d629af7d7f8ee637e
@@ -0,0 +1 @@
+20

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-18-72c6e9a4e0b434cef67144825346c687
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-18-72c6e9a4e0b434cef67144825346c687 b/sql/hive/src/test/resources/golden/partition_date-18-72c6e9a4e0b434cef67144825346c687
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-18-72c6e9a4e0b434cef67144825346c687
@@ -0,0 +1 @@
+10

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-19-44e5165eb210559e420105073bc96125
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-19-44e5165eb210559e420105073bc96125 b/sql/hive/src/test/resources/golden/partition_date-19-44e5165eb210559e420105073bc96125
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-19-44e5165eb210559e420105073bc96125
@@ -0,0 +1 @@
+20

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-20-7ec1f3a845e2c49191460e15af30aa30
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-20-7ec1f3a845e2c49191460e15af30aa30 b/sql/hive/src/test/resources/golden/partition_date-20-7ec1f3a845e2c49191460e15af30aa30
new file mode 100644
index 0000000..e69de29

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

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-6-1405c311915f27b0cc616c83d39eaacc
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-6-1405c311915f27b0cc616c83d39eaacc b/sql/hive/src/test/resources/golden/partition_date-6-1405c311915f27b0cc616c83d39eaacc
new file mode 100644
index 0000000..051ca3d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-6-1405c311915f27b0cc616c83d39eaacc
@@ -0,0 +1,2 @@
+2000-01-01
+2013-08-08

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-7-2ac950d8d5656549dd453e5464cb8530
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-7-2ac950d8d5656549dd453e5464cb8530 b/sql/hive/src/test/resources/golden/partition_date-7-2ac950d8d5656549dd453e5464cb8530
new file mode 100644
index 0000000..24192ee
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-7-2ac950d8d5656549dd453e5464cb8530
@@ -0,0 +1,5 @@
+165	val_165	2000-01-01	2
+238	val_238	2000-01-01	2
+27	val_27	2000-01-01	2
+311	val_311	2000-01-01	2
+86	val_86	2000-01-01	2

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-8-a425c11c12c9ce4c9c43d4fbccee5347
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-8-a425c11c12c9ce4c9c43d4fbccee5347 b/sql/hive/src/test/resources/golden/partition_date-8-a425c11c12c9ce4c9c43d4fbccee5347
new file mode 100644
index 0000000..60d3b2f
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-8-a425c11c12c9ce4c9c43d4fbccee5347
@@ -0,0 +1 @@
+15

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_date-9-aad6078a09b7bd8f5141437e86bb229f
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_date-9-aad6078a09b7bd8f5141437e86bb229f b/sql/hive/src/test/resources/golden/partition_date-9-aad6078a09b7bd8f5141437e86bb229f
new file mode 100644
index 0000000..60d3b2f
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_date-9-aad6078a09b7bd8f5141437e86bb229f
@@ -0,0 +1 @@
+15

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_type_check-12-7e053ba4f9dea1e74c1d04c557c3adac
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_type_check-12-7e053ba4f9dea1e74c1d04c557c3adac b/sql/hive/src/test/resources/golden/partition_type_check-12-7e053ba4f9dea1e74c1d04c557c3adac
new file mode 100644
index 0000000..91ba621
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/partition_type_check-12-7e053ba4f9dea1e74c1d04c557c3adac
@@ -0,0 +1,6 @@
+1	11	2008-01-01
+2	12	2008-01-01
+3	13	2008-01-01
+7	17	2008-01-01
+8	18	2008-01-01
+8	28	2008-01-01

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/partition_type_check-13-45fb706ff448da1fe609c7ff76a80d4d
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/partition_type_check-13-45fb706ff448da1fe609c7ff76a80d4d b/sql/hive/src/test/resources/golden/partition_type_check-13-45fb706ff448da1fe609c7ff76a80d4d
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/union_date-6-f4d5c71145a9b7464685aa7d09cd4dfd
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/union_date-6-f4d5c71145a9b7464685aa7d09cd4dfd b/sql/hive/src/test/resources/golden/union_date-6-f4d5c71145a9b7464685aa7d09cd4dfd
new file mode 100644
index 0000000..7941f53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/union_date-6-f4d5c71145a9b7464685aa7d09cd4dfd
@@ -0,0 +1,40 @@
+1064	2000-11-20
+1064	2000-11-20
+1142	2000-11-21
+1142	2000-11-21
+1599	2000-11-22
+1599	2000-11-22
+361	2000-11-23
+361	2000-11-23
+897	2000-11-24
+897	2000-11-24
+1531	2000-11-25
+1531	2000-11-25
+1610	2000-11-26
+1610	2000-11-26
+3198	2000-11-27
+3198	2000-11-27
+1064	2000-11-28
+1064	2000-11-28
+1142	2000-11-28
+1142	2000-11-28
+1064	2010-10-20
+1064	2010-10-20
+1142	2010-10-21
+1142	2010-10-21
+1599	2010-10-22
+1599	2010-10-22
+361	2010-10-23
+361	2010-10-23
+897	2010-10-24
+897	2010-10-24
+1531	2010-10-25
+1531	2010-10-25
+1610	2010-10-26
+1610	2010-10-26
+3198	2010-10-27
+3198	2010-10-27
+1064	2010-10-28
+1064	2010-10-28
+1142	2010-10-29
+1142	2010-10-29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/union_date-8-21306adbd8be8ad75174ad9d3e42b73c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/union_date-8-21306adbd8be8ad75174ad9d3e42b73c b/sql/hive/src/test/resources/golden/union_date-8-21306adbd8be8ad75174ad9d3e42b73c
new file mode 100644
index 0000000..e69de29


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


[2/2] git commit: [SPARK-3407][SQL]Add Date type support

Posted by ma...@apache.org.
[SPARK-3407][SQL]Add Date type support

Author: Daoyuan Wang <da...@intel.com>

Closes #2344 from adrian-wang/date and squashes the following commits:

f15074a [Daoyuan Wang] remove outdated lines
2038085 [Daoyuan Wang] update return type
00fe81f [Daoyuan Wang] address lian cheng's comments
0df6ea1 [Daoyuan Wang] rebase and remove simple string
bb1b1ef [Daoyuan Wang] remove failing test
aa96735 [Daoyuan Wang] not cast for same type compare
30bf48b [Daoyuan Wang] resolve rebase conflict
617d1a8 [Daoyuan Wang] add date_udf case to white list
c37e848 [Daoyuan Wang] comment update
5429212 [Daoyuan Wang] change to long
f8f219f [Daoyuan Wang] revise according to Cheng Hao
0e0a4f5 [Daoyuan Wang] minor format
4ddcb92 [Daoyuan Wang] add java api for date
0e3110e [Daoyuan Wang] try to fix timezone issue
17fda35 [Daoyuan Wang] set test list
2dfbb5b [Daoyuan Wang] support date type


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

Branch: refs/heads/master
Commit: 2ac40da3f9fa6d45a59bb45b41606f1931ac5e81
Parents: 46db277
Author: Daoyuan Wang <da...@intel.com>
Authored: Mon Oct 13 13:33:12 2014 -0700
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Mon Oct 13 13:33:12 2014 -0700

----------------------------------------------------------------------
 .../spark/sql/catalyst/ScalaReflection.scala    |   5 +-
 .../catalyst/analysis/HiveTypeCoercion.scala    |  29 +++-
 .../apache/spark/sql/catalyst/dsl/package.scala |   6 +-
 .../spark/sql/catalyst/expressions/Cast.scala   |  98 +++++++++++--
 .../sql/catalyst/expressions/literals.scala     |   3 +-
 .../spark/sql/catalyst/types/dataTypes.scala    |  12 +-
 .../expressions/ExpressionEvaluationSuite.scala |  35 ++++-
 .../org/apache/spark/sql/api/java/DataType.java |   5 +
 .../org/apache/spark/sql/api/java/DateType.java |  27 ++++
 .../spark/sql/columnar/ColumnAccessor.scala     |   4 +
 .../spark/sql/columnar/ColumnBuilder.scala      |   3 +
 .../apache/spark/sql/columnar/ColumnStats.scala |  20 ++-
 .../apache/spark/sql/columnar/ColumnType.scala  |  28 +++-
 .../scala/org/apache/spark/sql/package.scala    |  10 ++
 .../sql/types/util/DataTypeConversions.scala    |   3 +
 .../sql/ScalaReflectionRelationSuite.scala      |   5 +-
 .../spark/sql/columnar/ColumnStatsSuite.scala   |   1 +
 .../spark/sql/columnar/ColumnTypeSuite.scala    |   7 +-
 .../spark/sql/columnar/ColumnarTestUtils.scala  |   3 +-
 .../columnar/NullableColumnAccessorSuite.scala  |   4 +-
 .../columnar/NullableColumnBuilderSuite.scala   |   4 +-
 .../hive/execution/HiveCompatibilitySuite.scala |  10 ++
 .../org/apache/spark/sql/hive/HiveContext.scala |   6 +-
 .../apache/spark/sql/hive/HiveInspectors.scala  |   9 ++
 .../spark/sql/hive/HiveMetastoreCatalog.scala   |   2 +
 .../org/apache/spark/sql/hive/HiveQl.scala      |   8 ++
 .../date_1-0-23edf29bf7376c70d5ecf12720f4b1eb   |   0
 .../date_1-1-4ebe3571c13a8b0c03096fbd972b7f1b   |   0
 .../date_1-10-d964bec7e5632091ab5cb6f6786dbbf9  |   1 +
 .../date_1-11-480c5f024a28232b7857be327c992509  |   1 +
 .../date_1-12-4c0ed7fcb75770d8790575b586bf14f4  |   1 +
 .../date_1-13-44fc74c1993062c0a9522199ff27fea   |   1 +
 .../date_1-14-4855a66124b16d1d0d003235995ac06b  |   1 +
 .../date_1-15-8bc190dba0f641840b5e1e198a14c55b  |   1 +
 .../date_1-16-23edf29bf7376c70d5ecf12720f4b1eb  |   0
 .../date_1-2-abdce0c0d14d3fc7441b7c134b02f99a   |   0
 .../date_1-3-df16364a220ff96a6ea1cd478cbc1d0b   |   1 +
 .../date_1-4-d964bec7e5632091ab5cb6f6786dbbf9   |   1 +
 .../date_1-5-5e70fc74158fbfca38134174360de12d   |   0
 .../date_1-6-df16364a220ff96a6ea1cd478cbc1d0b   |   1 +
 .../date_1-7-d964bec7e5632091ab5cb6f6786dbbf9   |   1 +
 .../date_1-8-1d5c58095cd52ea539d869f2ab1ab67d   |   0
 .../date_1-9-df16364a220ff96a6ea1cd478cbc1d0b   |   1 +
 .../date_2-3-eedb73e0a622c2ab760b524f395dd4ba   | 137 +++++++++++++++++++
 .../date_2-4-3618dfde8da7c26f03bca72970db9ef7   | 137 +++++++++++++++++++
 .../date_2-5-fe9bebfc8994ddd8d7cd0208c1f0af3c   |  12 ++
 .../date_2-6-f4edce7cb20f325e8b69e787b2ae8882   |   0
 .../date_3-3-4cf49e71b636df754871a675f9e4e24    |   0
 .../date_3-4-e009f358964f6d1236cfc03283e2b06f   |   1 +
 .../date_3-5-c26de4559926ddb0127d2dc5ea154774   |   0
 .../date_4-0-b84f7e931d710dcbe3c5126d998285a8   |   0
 .../date_4-1-6272f5e518f6a20bc96a5870ff315c4f   |   0
 .../date_4-2-4a0e7bde447ef616b98e0f55d2886de0   |   0
 .../date_4-3-a23faa56b5d3ca9063a21f72b4278b00   |   0
 .../date_4-4-bee09a7384666043621f68297cee2e68   |   1 +
 .../date_4-5-b84f7e931d710dcbe3c5126d998285a8   |   0
 ...omparison-0-69eec445bd045c9dc899fafa348d8495 |   1 +
 ...omparison-1-fcc400871a502009c8680509e3869ec1 |   1 +
 ...mparison-10-a9f2560c273163e11306d4f1dd1d9d54 |   1 +
 ...mparison-11-4a7bac9ddcf40db6329faaec8e426543 |   1 +
 ...omparison-2-b8598a4d0c948c2ddcf3eeef0abf2264 |   1 +
 ...omparison-3-14d35f266be9cceb11a2ae09ec8b3835 |   1 +
 ...omparison-4-c8865b14d53f2c2496fb69ee8191bf37 |   1 +
 ...omparison-5-f2c907e64da8166a731ddc0ed19bad6c |   1 +
 ...omparison-6-5606505a92bad10023ad9a3ef77eacc9 |   1 +
 ...comparison-7-47913d4aaf0d468ab3764cc3bfd68eb |   1 +
 ...omparison-8-1e5ce4f833b6fba45618437c8fb7643c |   1 +
 ...omparison-9-bcd987341fc1c38047a27d29dac6ae7c |   1 +
 ...ate_join1-3-f71c7be760fb4de4eff8225f2c6614b2 |  22 +++
 ...date_join1-4-70b9b49c55699fe94cfde069f5d197c |   0
 ...te_serde-10-d80e681519dcd8f5078c5602bb5befa9 |   0
 ...te_serde-11-29540200936bba47f17553547b409af7 |   0
 ...te_serde-12-c3c3275658b89d31fc504db31ae9f99c |   0
 ...te_serde-13-6c546456c81e635b6753e1552fac9129 |   1 +
 ...te_serde-14-f8ba18cc7b0225b4022299c44d435101 |   1 +
 ...te_serde-15-66fadc9bcea7d107a610758aa6f50ff3 |   0
 ...te_serde-16-1bd3345b46f77e17810978e56f9f7c6b |   0
 ...te_serde-17-a0df43062f8ab676ef728c9968443f12 |   0
 ...te_serde-18-b50ecc72ce9018ab12fb17568fef038a |   1 +
 ...te_serde-19-28f1cf92bdd6b2e5d328cd9d10f828b6 |   1 +
 ...te_serde-20-588516368d8c1533cb7bfb2157fd58c1 |   0
 ...te_serde-21-dfe166fe053468e738dca23ebe043091 |   0
 ...te_serde-22-45240a488fb708e432d2f45b74ef7e63 |   0
 ...te_serde-23-1742a51e4967a8d263572d890cd8d4a8 |   1 +
 ...ate_serde-24-14fd49bd6fee907c1699f7b4e26685b |   1 +
 ...te_serde-25-a199cf185184a25190d65c123d0694ee |   0
 ...te_serde-26-c5fa68d9aff36f22e5edc1b54332d0ab |   0
 ...te_serde-27-4d86c79f858866acec3c37f6598c2638 |   0
 ...te_serde-28-16a41fc9e0f51eb417c763bae8e9cadb |   1 +
 ...te_serde-29-bd1cb09aacd906527b0bbf43bbded812 |   1 +
 ...te_serde-30-7c80741f9f485729afc68609c55423a0 |   0
 ...ate_serde-31-da36cd1654aee055cb3650133c9d11f |   0
 ...te_serde-32-bb2f76bd307ed616a3c797f8dd45a8d1 |   0
 ...te_serde-33-a742813b024e6dcfb4a358aa4e9fcdb6 |   1 +
 ...te_serde-34-6485841336c097895ad5b34f42c0745f |   1 +
 ...te_serde-35-8651a7c351cbc07fb1af6193f6885de8 |   0
 ...te_serde-36-36e6041f53433482631018410bb62a99 |   0
 ...te_serde-37-3ddfd8ecb28991aeed588f1ea852c427 |   0
 ...te_serde-38-e6167e27465514356c557a77d956ea46 |   0
 ...te_serde-39-c1e17c93582656c12970c37bac153bf2 |   0
 ...te_serde-40-4a17944b9ec8999bb20c5ba5d4cb877c |   0
 ...ate_serde-8-cace4f60a08342f58fbe816a9c3a73cf | 137 +++++++++++++++++++
 ...ate_serde-9-436c3c61cc4278b54ac79c53c88ff422 |  12 ++
 .../date_udf-0-84604a42a5d7f2842f1eec10c689d447 |   0
 .../date_udf-1-5e8136f6a6503ae9bef9beca80fada13 |   0
 ...date_udf-10-988ad9744096a29a3672a2d4c121299b |   1 +
 ...date_udf-11-a5100dd42201b5bc035a9d684cc21bdc |   1 +
 ...date_udf-12-eb7280a1f191344a99eaa0f805e8faff |   1 +
 ...date_udf-13-cc99e4f14fd092994b006ee7ebe4fc92 |   1 +
 .../date_udf-14-a6a5ce5134cc1125355a4bdf0a73d97 |   1 +
 ...date_udf-15-d031ee50c119d7c6acafd53543dbd0c4 |   1 +
 ...date_udf-16-dc59f69e1685e8d923b187ec50d80f06 |   1 +
 ...date_udf-17-7d046d4efc568049cf3792470b6feab9 |   1 +
 ...date_udf-18-84604a42a5d7f2842f1eec10c689d447 |   0
 ...date_udf-19-5e8136f6a6503ae9bef9beca80fada13 |   0
 .../date_udf-2-10e337c34d1e82a360b8599988f4b266 |   0
 ...date_udf-20-10e337c34d1e82a360b8599988f4b266 |   0
 .../date_udf-3-29e406e613c0284b3e16a8943a4d31bd |   0
 .../date_udf-4-23653315213f578856ab5c3bd80c0264 |   0
 .../date_udf-5-891fd92a4787b9789f6d1f51c1eddc8a |   0
 .../date_udf-6-3473c118d20783eafb456043a2ee5d5b |   0
 .../date_udf-7-9fb5165824e161074565e7500959c1b2 |   0
 .../date_udf-8-badfe833681362092fc6345f888b1c21 |   1 +
 .../date_udf-9-a8cbb039661d796beaa0d1564c58c563 |   1 +
 ...tion_date-0-7ec1f3a845e2c49191460e15af30aa30 |   0
 ...tion_date-1-916193405ce5e020dcd32c58325db6fe |   0
 ...ion_date-10-a8dde9c0b5746dd770c9c262d23ffb10 |   1 +
 ...ion_date-11-fdface2fb6eef67f15bb7d0de2294957 |   1 +
 ...ion_date-12-9b945f8ece6e09ad28c866ff3a10cc24 |   1 +
 ...tion_date-13-b7cb91c7c459798078a79071d329dbf |   1 +
 ...ion_date-14-e4366325f3a0c4a8e92be59f4de73fce |   1 +
 ...ion_date-15-a062a6e87867d8c8cfbdad97bedcbe5f |   1 +
 ...ion_date-16-22a5627d9ac112665eae01d07a91c89c |   1 +
 ...tion_date-17-b9ce94ef93cb16d629af7d7f8ee637e |   1 +
 ...ion_date-18-72c6e9a4e0b434cef67144825346c687 |   1 +
 ...ion_date-19-44e5165eb210559e420105073bc96125 |   1 +
 ...tion_date-2-e2e70ac0f4e0ea987b49b86f73d819c9 |   0
 ...ion_date-20-7ec1f3a845e2c49191460e15af30aa30 |   0
 ...tion_date-3-c938b08f57d588926a5d5fbfa4531012 |   0
 ...tion_date-4-a93eff99ce43bb939ec1d6464c0ef0b3 |   0
 ...tion_date-5-a855aba47876561fd4fb095e09580686 |   0
 ...tion_date-6-1405c311915f27b0cc616c83d39eaacc |   2 +
 ...tion_date-7-2ac950d8d5656549dd453e5464cb8530 |   5 +
 ...tion_date-8-a425c11c12c9ce4c9c43d4fbccee5347 |   1 +
 ...tion_date-9-aad6078a09b7bd8f5141437e86bb229f |   1 +
 ...pe_check-12-7e053ba4f9dea1e74c1d04c557c3adac |   6 +
 ...pe_check-13-45fb706ff448da1fe609c7ff76a80d4d |   0
 ...nion_date-6-f4d5c71145a9b7464685aa7d09cd4dfd |  40 ++++++
 ...nion_date-7-a0bade1c77338d4f72962389a1f5bea2 |   0
 ...nion_date-8-21306adbd8be8ad75174ad9d3e42b73c |   0
 150 files changed, 872 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
index b3ae8e6..3d4296f 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.catalyst
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.apache.spark.sql.catalyst.expressions.{GenericRow, Attribute, AttributeReference}
 import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
@@ -77,8 +77,9 @@ object ScalaReflection {
       val Schema(valueDataType, valueNullable) = schemaFor(valueType)
       Schema(MapType(schemaFor(keyType).dataType,
         valueDataType, valueContainsNull = valueNullable), nullable = true)
-    case t if t <:< typeOf[String]            => Schema(StringType, nullable = true)
+    case t if t <:< typeOf[String] => Schema(StringType, nullable = true)
     case t if t <:< typeOf[Timestamp] => Schema(TimestampType, nullable = true)
+    case t if t <:< typeOf[Date] => Schema(DateType, nullable = true)
     case t if t <:< typeOf[BigDecimal] => Schema(DecimalType, nullable = true)
     case t if t <:< typeOf[java.lang.Integer] => Schema(IntegerType, nullable = true)
     case t if t <:< typeOf[java.lang.Long] => Schema(LongType, nullable = true)

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
index 6488185..7c480de 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
@@ -220,20 +220,39 @@ trait HiveTypeCoercion {
       case a: BinaryArithmetic if a.right.dataType == StringType =>
         a.makeCopy(Array(a.left, Cast(a.right, DoubleType)))
 
+      // we should cast all timestamp/date/string compare into string compare
+      case p: BinaryPredicate if p.left.dataType == StringType
+        && p.right.dataType == DateType =>
+        p.makeCopy(Array(p.left, Cast(p.right, StringType)))
+      case p: BinaryPredicate if p.left.dataType == DateType
+        && p.right.dataType == StringType =>
+        p.makeCopy(Array(Cast(p.left, StringType), p.right))
       case p: BinaryPredicate if p.left.dataType == StringType
         && p.right.dataType == TimestampType =>
-        p.makeCopy(Array(Cast(p.left, TimestampType), p.right))
+        p.makeCopy(Array(p.left, Cast(p.right, StringType)))
       case p: BinaryPredicate if p.left.dataType == TimestampType
         && p.right.dataType == StringType =>
-        p.makeCopy(Array(p.left, Cast(p.right, TimestampType)))
+        p.makeCopy(Array(Cast(p.left, StringType), p.right))
+      case p: BinaryPredicate if p.left.dataType == TimestampType
+        && p.right.dataType == DateType =>
+        p.makeCopy(Array(Cast(p.left, StringType), Cast(p.right, StringType)))
+      case p: BinaryPredicate if p.left.dataType == DateType
+        && p.right.dataType == TimestampType =>
+        p.makeCopy(Array(Cast(p.left, StringType), Cast(p.right, StringType)))
 
       case p: BinaryPredicate if p.left.dataType == StringType && p.right.dataType != StringType =>
         p.makeCopy(Array(Cast(p.left, DoubleType), p.right))
       case p: BinaryPredicate if p.left.dataType != StringType && p.right.dataType == StringType =>
         p.makeCopy(Array(p.left, Cast(p.right, DoubleType)))
 
-      case i @ In(a,b) if a.dataType == TimestampType && b.forall(_.dataType == StringType) =>
-        i.makeCopy(Array(a,b.map(Cast(_,TimestampType))))
+      case i @ In(a, b) if a.dataType == DateType && b.forall(_.dataType == StringType) =>
+        i.makeCopy(Array(Cast(a, StringType), b))
+      case i @ In(a, b) if a.dataType == TimestampType && b.forall(_.dataType == StringType) =>
+        i.makeCopy(Array(Cast(a, StringType), b))
+      case i @ In(a, b) if a.dataType == DateType && b.forall(_.dataType == TimestampType) =>
+        i.makeCopy(Array(Cast(a, StringType), b.map(Cast(_, StringType))))
+      case i @ In(a, b) if a.dataType == TimestampType && b.forall(_.dataType == DateType) =>
+        i.makeCopy(Array(Cast(a, StringType), b.map(Cast(_, StringType))))
 
       case Sum(e) if e.dataType == StringType =>
         Sum(Cast(e, DoubleType))
@@ -283,6 +302,8 @@ trait HiveTypeCoercion {
       // Skip if the type is boolean type already. Note that this extra cast should be removed
       // by optimizer.SimplifyCasts.
       case Cast(e, BooleanType) if e.dataType == BooleanType => e
+      // DateType should be null if be cast to boolean.
+      case Cast(e, BooleanType) if e.dataType == DateType => Cast(e, BooleanType)
       // If the data type is not boolean and is being cast boolean, turn it into a comparison
       // with the numeric value, i.e. x != 0. This will coerce the type into numeric type.
       case Cast(e, BooleanType) if e.dataType != BooleanType => Not(EqualTo(e, Literal(0)))

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
index deb622c..75b6e37 100755
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.catalyst
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import scala.language.implicitConversions
 
@@ -119,6 +119,7 @@ package object dsl {
     implicit def floatToLiteral(f: Float) = Literal(f)
     implicit def doubleToLiteral(d: Double) = Literal(d)
     implicit def stringToLiteral(s: String) = Literal(s)
+    implicit def dateToLiteral(d: Date) = Literal(d)
     implicit def decimalToLiteral(d: BigDecimal) = Literal(d)
     implicit def timestampToLiteral(t: Timestamp) = Literal(t)
     implicit def binaryToLiteral(a: Array[Byte]) = Literal(a)
@@ -174,6 +175,9 @@ package object dsl {
       /** Creates a new AttributeReference of type string */
       def string = AttributeReference(s, StringType, nullable = true)()
 
+      /** Creates a new AttributeReference of type date */
+      def date = AttributeReference(s, DateType, nullable = true)()
+
       /** Creates a new AttributeReference of type decimal */
       def decimal = AttributeReference(s, DecimalType, nullable = true)()
 

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
index f626d09..8e5ee12 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
@@ -17,18 +17,21 @@
 
 package org.apache.spark.sql.catalyst.expressions
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 import java.text.{DateFormat, SimpleDateFormat}
 
+import org.apache.spark.Logging
+import org.apache.spark.sql.catalyst.errors.TreeNodeException
 import org.apache.spark.sql.catalyst.types._
 
 /** Cast the child expression to the target data type. */
-case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
+case class Cast(child: Expression, dataType: DataType) extends UnaryExpression with Logging {
   override def foldable = child.foldable
 
   override def nullable = (child.dataType, dataType) match {
     case (StringType, _: NumericType) => true
     case (StringType, TimestampType)  => true
+    case (StringType, DateType)       => true
     case _                            => child.nullable
   }
 
@@ -42,6 +45,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
   // UDFToString
   private[this] def castToString: Any => Any = child.dataType match {
     case BinaryType => buildCast[Array[Byte]](_, new String(_, "UTF-8"))
+    case DateType => buildCast[Date](_, dateToString)
     case TimestampType => buildCast[Timestamp](_, timestampToString)
     case _ => buildCast[Any](_, _.toString)
   }
@@ -56,7 +60,10 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
     case StringType =>
       buildCast[String](_, _.length() != 0)
     case TimestampType =>
-      buildCast[Timestamp](_, b => b.getTime() != 0 || b.getNanos() != 0)
+      buildCast[Timestamp](_, t => t.getTime() != 0 || t.getNanos() != 0)
+    case DateType =>
+      // Hive would return null when cast from date to boolean
+      buildCast[Date](_, d => null)
     case LongType =>
       buildCast[Long](_, _ != 0)
     case IntegerType =>
@@ -95,6 +102,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       buildCast[Short](_, s => new Timestamp(s))
     case ByteType =>
       buildCast[Byte](_, b => new Timestamp(b))
+    case DateType =>
+      buildCast[Date](_, d => new Timestamp(d.getTime))
     // TimestampWritable.decimalToTimestamp
     case DecimalType =>
       buildCast[BigDecimal](_, d => decimalToTimestamp(d))
@@ -130,7 +139,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
   // Converts Timestamp to string according to Hive TimestampWritable convention
   private[this] def timestampToString(ts: Timestamp): String = {
     val timestampString = ts.toString
-    val formatted = Cast.threadLocalDateFormat.get.format(ts)
+    val formatted = Cast.threadLocalTimestampFormat.get.format(ts)
 
     if (timestampString.length > 19 && timestampString.substring(19) != ".0") {
       formatted + timestampString.substring(19)
@@ -139,6 +148,39 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
     }
   }
 
+  // Converts Timestamp to string according to Hive TimestampWritable convention
+  private[this] def timestampToDateString(ts: Timestamp): String = {
+    Cast.threadLocalDateFormat.get.format(ts)
+  }
+
+  // DateConverter
+  private[this] def castToDate: Any => Any = child.dataType match {
+    case StringType =>
+      buildCast[String](_, s =>
+        try Date.valueOf(s) catch { case _: java.lang.IllegalArgumentException => null }
+      )
+    case TimestampType =>
+      // throw valid precision more than seconds, according to Hive.
+      // Timestamp.nanos is in 0 to 999,999,999, no more than a second.
+      buildCast[Timestamp](_, t => new Date(Math.floor(t.getTime / 1000.0).toLong * 1000))
+    // Hive throws this exception as a Semantic Exception
+    // It is never possible to compare result when hive return with exception, so we can return null
+    // NULL is more reasonable here, since the query itself obeys the grammar.
+    case _ => _ => null
+  }
+
+  // Date cannot be cast to long, according to hive
+  private[this] def dateToLong(d: Date) = null
+
+  // Date cannot be cast to double, according to hive
+  private[this] def dateToDouble(d: Date) = null
+
+  // Converts Date to string according to Hive DateWritable convention
+  private[this] def dateToString(d: Date): String = {
+    Cast.threadLocalDateFormat.get.format(d)
+  }
+
+  // LongConverter
   private[this] def castToLong: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toLong catch {
@@ -146,6 +188,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1L else 0L)
+    case DateType =>
+      buildCast[Date](_, d => dateToLong(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToLong(t))
     case DecimalType =>
@@ -154,6 +198,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => x.numeric.asInstanceOf[Numeric[Any]].toLong(b)
   }
 
+  // IntConverter
   private[this] def castToInt: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toInt catch {
@@ -161,6 +206,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1 else 0)
+    case DateType =>
+      buildCast[Date](_, d => dateToLong(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToLong(t).toInt)
     case DecimalType =>
@@ -169,6 +216,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => x.numeric.asInstanceOf[Numeric[Any]].toInt(b)
   }
 
+  // ShortConverter
   private[this] def castToShort: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toShort catch {
@@ -176,6 +224,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1.toShort else 0.toShort)
+    case DateType =>
+      buildCast[Date](_, d => dateToLong(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToLong(t).toShort)
     case DecimalType =>
@@ -184,6 +234,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => x.numeric.asInstanceOf[Numeric[Any]].toInt(b).toShort
   }
 
+  // ByteConverter
   private[this] def castToByte: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toByte catch {
@@ -191,6 +242,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1.toByte else 0.toByte)
+    case DateType =>
+      buildCast[Date](_, d => dateToLong(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToLong(t).toByte)
     case DecimalType =>
@@ -199,6 +252,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => x.numeric.asInstanceOf[Numeric[Any]].toInt(b).toByte
   }
 
+  // DecimalConverter
   private[this] def castToDecimal: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try BigDecimal(s.toDouble) catch {
@@ -206,6 +260,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) BigDecimal(1) else BigDecimal(0))
+    case DateType =>
+      buildCast[Date](_, d => dateToDouble(d))
     case TimestampType =>
       // Note that we lose precision here.
       buildCast[Timestamp](_, t => BigDecimal(timestampToDouble(t)))
@@ -213,6 +269,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => BigDecimal(x.numeric.asInstanceOf[Numeric[Any]].toDouble(b))
   }
 
+  // DoubleConverter
   private[this] def castToDouble: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toDouble catch {
@@ -220,6 +277,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1d else 0d)
+    case DateType =>
+      buildCast[Date](_, d => dateToDouble(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToDouble(t))
     case DecimalType =>
@@ -228,6 +287,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       b => x.numeric.asInstanceOf[Numeric[Any]].toDouble(b)
   }
 
+  // FloatConverter
   private[this] def castToFloat: Any => Any = child.dataType match {
     case StringType =>
       buildCast[String](_, s => try s.toFloat catch {
@@ -235,6 +295,8 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
       })
     case BooleanType =>
       buildCast[Boolean](_, b => if (b) 1f else 0f)
+    case DateType =>
+      buildCast[Date](_, d => dateToDouble(d))
     case TimestampType =>
       buildCast[Timestamp](_, t => timestampToDouble(t).toFloat)
     case DecimalType =>
@@ -245,17 +307,18 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
 
   private[this] lazy val cast: Any => Any = dataType match {
     case dt if dt == child.dataType => identity[Any]
-    case StringType => castToString
-    case BinaryType => castToBinary
-    case DecimalType => castToDecimal
+    case StringType    => castToString
+    case BinaryType    => castToBinary
+    case DecimalType   => castToDecimal
+    case DateType      => castToDate
     case TimestampType => castToTimestamp
-    case BooleanType => castToBoolean
-    case ByteType => castToByte
-    case ShortType => castToShort
-    case IntegerType => castToInt
-    case FloatType => castToFloat
-    case LongType => castToLong
-    case DoubleType => castToDouble
+    case BooleanType   => castToBoolean
+    case ByteType      => castToByte
+    case ShortType     => castToShort
+    case IntegerType   => castToInt
+    case FloatType     => castToFloat
+    case LongType      => castToLong
+    case DoubleType    => castToDouble
   }
 
   override def eval(input: Row): Any = {
@@ -268,6 +331,13 @@ object Cast {
   // `SimpleDateFormat` is not thread-safe.
   private[sql] val threadLocalDateFormat = new ThreadLocal[DateFormat] {
     override def initialValue() = {
+      new SimpleDateFormat("yyyy-MM-dd")
+    }
+  }
+
+  // `SimpleDateFormat` is not thread-safe.
+  private[sql] val threadLocalTimestampFormat = new ThreadLocal[DateFormat] {
+    override def initialValue() = {
       new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
     }
   }

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
index 78a0c55..ba24023 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.catalyst.expressions
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.apache.spark.sql.catalyst.types._
 
@@ -33,6 +33,7 @@ object Literal {
     case b: Boolean => Literal(b, BooleanType)
     case d: BigDecimal => Literal(d, DecimalType)
     case t: Timestamp => Literal(t, TimestampType)
+    case d: Date => Literal(d, DateType)
     case a: Array[Byte] => Literal(a, BinaryType)
     case null => Literal(null, NullType)
   }

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala
index 5bdacab..0cf139e 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.catalyst.types
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import scala.math.Numeric.{BigDecimalAsIfIntegral, DoubleAsIfIntegral, FloatAsIfIntegral}
 import scala.reflect.ClassTag
@@ -250,6 +250,16 @@ case object TimestampType extends NativeType {
   }
 }
 
+case object DateType extends NativeType {
+  private[sql] type JvmType = Date
+
+  @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized { typeTag[JvmType] }
+
+  private[sql] val ordering = new Ordering[JvmType] {
+    def compare(x: Date, y: Date) = x.compareTo(y)
+  }
+}
+
 abstract class NumericType extends NativeType with PrimitiveType {
   // Unfortunately we can't get this implicitly as that breaks Spark Serialization. In order for
   // implicitly[Numeric[JvmType]] to be valid, we have to change JvmType from a type variable to a

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala
index 692ed78..6dc5942 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.catalyst.expressions
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import scala.collection.immutable.HashSet
 
@@ -252,8 +252,11 @@ class ExpressionEvaluationSuite extends FunSuite {
 
   test("data type casting") {
 
-    val sts = "1970-01-01 00:00:01.1"
-    val ts = Timestamp.valueOf(sts)
+    val sd = "1970-01-01"
+    val d = Date.valueOf(sd)
+    val sts = sd + " 00:00:02"
+    val nts = sts + ".1"
+    val ts = Timestamp.valueOf(nts)
 
     checkEvaluation("abdef" cast StringType, "abdef")
     checkEvaluation("abdef" cast DecimalType, null)
@@ -266,8 +269,15 @@ class ExpressionEvaluationSuite extends FunSuite {
     checkEvaluation(Cast(Literal(1.toDouble) cast TimestampType, DoubleType), 1.toDouble)
     checkEvaluation(Cast(Literal(1.toDouble) cast TimestampType, DoubleType), 1.toDouble)
 
-    checkEvaluation(Cast(Literal(sts) cast TimestampType, StringType), sts)
+    checkEvaluation(Cast(Literal(sd) cast DateType, StringType), sd)
+    checkEvaluation(Cast(Literal(d) cast StringType, DateType), d)
+    checkEvaluation(Cast(Literal(nts) cast TimestampType, StringType), nts)
     checkEvaluation(Cast(Literal(ts) cast StringType, TimestampType), ts)
+    // all convert to string type to check
+    checkEvaluation(
+      Cast(Cast(Literal(nts) cast TimestampType, DateType), StringType), sd)
+    checkEvaluation(
+      Cast(Cast(Literal(ts) cast DateType, TimestampType), StringType), sts)
 
     checkEvaluation(Cast("abdef" cast BinaryType, StringType), "abdef")
 
@@ -316,6 +326,12 @@ class ExpressionEvaluationSuite extends FunSuite {
     checkEvaluation(Cast(Literal(null, IntegerType), ShortType), null)
   }
 
+  test("date") {
+    val d1 = Date.valueOf("1970-01-01")
+    val d2 = Date.valueOf("1970-01-02")
+    checkEvaluation(Literal(d1) < Literal(d2), true)
+  }
+
   test("timestamp") {
     val ts1 = new Timestamp(12)
     val ts2 = new Timestamp(123)
@@ -323,6 +339,17 @@ class ExpressionEvaluationSuite extends FunSuite {
     checkEvaluation(Literal(ts1) < Literal(ts2), true)
   }
 
+  test("date casting") {
+    val d = Date.valueOf("1970-01-01")
+    checkEvaluation(Cast(d, ShortType), null)
+    checkEvaluation(Cast(d, IntegerType), null)
+    checkEvaluation(Cast(d, LongType), null)
+    checkEvaluation(Cast(d, FloatType), null)
+    checkEvaluation(Cast(d, DoubleType), null)
+    checkEvaluation(Cast(d, StringType), "1970-01-01")
+    checkEvaluation(Cast(Cast(d, TimestampType), StringType), "1970-01-01 00:00:00")
+  }
+
   test("timestamp casting") {
     val millis = 15 * 1000 + 2
     val seconds = millis * 1000 + 2

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java
----------------------------------------------------------------------
diff --git a/sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java b/sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java
index 37b4c8f..37e88d7 100644
--- a/sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java
+++ b/sql/core/src/main/java/org/apache/spark/sql/api/java/DataType.java
@@ -45,6 +45,11 @@ public abstract class DataType {
   public static final BooleanType BooleanType = new BooleanType();
 
   /**
+   * Gets the DateType object.
+   */
+  public static final DateType DateType = new DateType();
+
+  /**
    * Gets the TimestampType object.
    */
   public static final TimestampType TimestampType = new TimestampType();

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/java/org/apache/spark/sql/api/java/DateType.java
----------------------------------------------------------------------
diff --git a/sql/core/src/main/java/org/apache/spark/sql/api/java/DateType.java b/sql/core/src/main/java/org/apache/spark/sql/api/java/DateType.java
new file mode 100644
index 0000000..6677793
--- /dev/null
+++ b/sql/core/src/main/java/org/apache/spark/sql/api/java/DateType.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.api.java;
+
+/**
+ * The data type representing java.sql.Date values.
+ *
+ * {@code DateType} is represented by the singleton object {@link DataType#DateType}.
+ */
+public class DateType extends DataType {
+    protected DateType() {}
+}

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnAccessor.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnAccessor.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnAccessor.scala
index c9faf08..538dd5b 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnAccessor.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnAccessor.scala
@@ -92,6 +92,9 @@ private[sql] class FloatColumnAccessor(buffer: ByteBuffer)
 private[sql] class StringColumnAccessor(buffer: ByteBuffer)
   extends NativeColumnAccessor(buffer, STRING)
 
+private[sql] class DateColumnAccessor(buffer: ByteBuffer)
+  extends NativeColumnAccessor(buffer, DATE)
+
 private[sql] class TimestampColumnAccessor(buffer: ByteBuffer)
   extends NativeColumnAccessor(buffer, TIMESTAMP)
 
@@ -118,6 +121,7 @@ private[sql] object ColumnAccessor {
       case BYTE.typeId      => new ByteColumnAccessor(dup)
       case SHORT.typeId     => new ShortColumnAccessor(dup)
       case STRING.typeId    => new StringColumnAccessor(dup)
+      case DATE.typeId      => new DateColumnAccessor(dup)
       case TIMESTAMP.typeId => new TimestampColumnAccessor(dup)
       case BINARY.typeId    => new BinaryColumnAccessor(dup)
       case GENERIC.typeId   => new GenericColumnAccessor(dup)

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
index 2e61a98..300cef1 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
@@ -107,6 +107,8 @@ private[sql] class FloatColumnBuilder extends NativeColumnBuilder(new FloatColum
 
 private[sql] class StringColumnBuilder extends NativeColumnBuilder(new StringColumnStats, STRING)
 
+private[sql] class DateColumnBuilder extends NativeColumnBuilder(new DateColumnStats, DATE)
+
 private[sql] class TimestampColumnBuilder
   extends NativeColumnBuilder(new TimestampColumnStats, TIMESTAMP)
 
@@ -151,6 +153,7 @@ private[sql] object ColumnBuilder {
       case STRING.typeId    => new StringColumnBuilder
       case BINARY.typeId    => new BinaryColumnBuilder
       case GENERIC.typeId   => new GenericColumnBuilder
+      case DATE.typeId      => new DateColumnBuilder
       case TIMESTAMP.typeId => new TimestampColumnBuilder
     }).asInstanceOf[ColumnBuilder]
 

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnStats.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnStats.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnStats.scala
index 203a714..b34ab25 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnStats.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnStats.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.columnar
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.apache.spark.sql.Row
 import org.apache.spark.sql.catalyst.expressions.{AttributeMap, Attribute, AttributeReference}
@@ -190,6 +190,24 @@ private[sql] class StringColumnStats extends ColumnStats {
   def collectedStatistics = Row(lower, upper, nullCount)
 }
 
+private[sql] class DateColumnStats extends ColumnStats {
+  var upper: Date = null
+  var lower: Date = null
+  var nullCount = 0
+
+  override def gatherStats(row: Row, ordinal: Int) {
+    if (!row.isNullAt(ordinal)) {
+      val value = row(ordinal).asInstanceOf[Date]
+      if (upper == null || value.compareTo(upper) > 0) upper = value
+      if (lower == null || value.compareTo(lower) < 0) lower = value
+    } else {
+      nullCount += 1
+    }
+  }
+
+  def collectedStatistics = Row(lower, upper, nullCount)
+}
+
 private[sql] class TimestampColumnStats extends ColumnStats {
   var upper: Timestamp = null
   var lower: Timestamp = null

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala
index 198b575..ab66c85 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnType.scala
@@ -18,7 +18,7 @@
 package org.apache.spark.sql.columnar
 
 import java.nio.ByteBuffer
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import scala.reflect.runtime.universe.TypeTag
 
@@ -335,7 +335,26 @@ private[sql] object STRING extends NativeColumnType(StringType, 7, 8) {
   }
 }
 
-private[sql] object TIMESTAMP extends NativeColumnType(TimestampType, 8, 12) {
+private[sql] object DATE extends NativeColumnType(DateType, 8, 8) {
+  override def extract(buffer: ByteBuffer) = {
+    val date = new Date(buffer.getLong())
+    date
+  }
+
+  override def append(v: Date, buffer: ByteBuffer): Unit = {
+    buffer.putLong(v.getTime)
+  }
+
+  override def getField(row: Row, ordinal: Int) = {
+    row(ordinal).asInstanceOf[Date]
+  }
+
+  override def setField(row: MutableRow, ordinal: Int, value: Date): Unit = {
+    row(ordinal) = value
+  }
+}
+
+private[sql] object TIMESTAMP extends NativeColumnType(TimestampType, 9, 12) {
   override def extract(buffer: ByteBuffer) = {
     val timestamp = new Timestamp(buffer.getLong())
     timestamp.setNanos(buffer.getInt())
@@ -376,7 +395,7 @@ private[sql] sealed abstract class ByteArrayColumnType[T <: DataType](
   }
 }
 
-private[sql] object BINARY extends ByteArrayColumnType[BinaryType.type](9, 16) {
+private[sql] object BINARY extends ByteArrayColumnType[BinaryType.type](10, 16) {
   override def setField(row: MutableRow, ordinal: Int, value: Array[Byte]): Unit = {
     row(ordinal) = value
   }
@@ -387,7 +406,7 @@ private[sql] object BINARY extends ByteArrayColumnType[BinaryType.type](9, 16) {
 // Used to process generic objects (all types other than those listed above). Objects should be
 // serialized first before appending to the column `ByteBuffer`, and is also extracted as serialized
 // byte array.
-private[sql] object GENERIC extends ByteArrayColumnType[DataType](10, 16) {
+private[sql] object GENERIC extends ByteArrayColumnType[DataType](11, 16) {
   override def setField(row: MutableRow, ordinal: Int, value: Array[Byte]): Unit = {
     row(ordinal) = SparkSqlSerializer.deserialize[Any](value)
   }
@@ -407,6 +426,7 @@ private[sql] object ColumnType {
       case ShortType     => SHORT
       case StringType    => STRING
       case BinaryType    => BINARY
+      case DateType      => DATE
       case TimestampType => TIMESTAMP
       case _             => GENERIC
     }

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/package.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/package.scala b/sql/core/src/main/scala/org/apache/spark/sql/package.scala
index f513eae..e98d151 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/package.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/package.scala
@@ -168,6 +168,16 @@ package object sql {
   /**
    * :: DeveloperApi ::
    *
+   * The data type representing `java.sql.Date` values.
+   *
+   * @group dataType
+   */
+  @DeveloperApi
+  val DateType = catalyst.types.DateType
+
+  /**
+   * :: DeveloperApi ::
+   *
    * The data type representing `scala.math.BigDecimal` values.
    *
    * @group dataType

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala b/sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala
index 77353f4..e44cb08 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala
@@ -41,6 +41,7 @@ protected[sql] object DataTypeConversions {
     case StringType => JDataType.StringType
     case BinaryType => JDataType.BinaryType
     case BooleanType => JDataType.BooleanType
+    case DateType => JDataType.DateType
     case TimestampType => JDataType.TimestampType
     case DecimalType => JDataType.DecimalType
     case DoubleType => JDataType.DoubleType
@@ -80,6 +81,8 @@ protected[sql] object DataTypeConversions {
       BinaryType
     case booleanType: org.apache.spark.sql.api.java.BooleanType =>
       BooleanType
+    case dateType: org.apache.spark.sql.api.java.DateType =>
+      DateType
     case timestampType: org.apache.spark.sql.api.java.TimestampType =>
       TimestampType
     case decimalType: org.apache.spark.sql.api.java.DecimalType =>

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/ScalaReflectionRelationSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/ScalaReflectionRelationSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/ScalaReflectionRelationSuite.scala
index e24c521..bfa9ea4 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/ScalaReflectionRelationSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/ScalaReflectionRelationSuite.scala
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.scalatest.FunSuite
 
@@ -34,6 +34,7 @@ case class ReflectData(
     byteField: Byte,
     booleanField: Boolean,
     decimalField: BigDecimal,
+    date: Date,
     timestampField: Timestamp,
     seqInt: Seq[Int])
 
@@ -76,7 +77,7 @@ case class ComplexReflectData(
 class ScalaReflectionRelationSuite extends FunSuite {
   test("query case class RDD") {
     val data = ReflectData("a", 1, 1L, 1.toFloat, 1.toDouble, 1.toShort, 1.toByte, true,
-                           BigDecimal(1), new Timestamp(12345), Seq(1,2,3))
+                           BigDecimal(1), new Date(12345), new Timestamp(12345), Seq(1,2,3))
     val rdd = sparkContext.parallelize(data :: Nil)
     rdd.registerTempTable("reflectData")
 

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnStatsSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnStatsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnStatsSuite.scala
index 0cdbb31..6bdf741 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnStatsSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnStatsSuite.scala
@@ -30,6 +30,7 @@ class ColumnStatsSuite extends FunSuite {
   testColumnStats(classOf[FloatColumnStats], FLOAT, Row(Float.MaxValue, Float.MinValue, 0))
   testColumnStats(classOf[DoubleColumnStats], DOUBLE, Row(Double.MaxValue, Double.MinValue, 0))
   testColumnStats(classOf[StringColumnStats], STRING, Row(null, null, 0))
+  testColumnStats(classOf[DateColumnStats], DATE, Row(null, null, 0))
   testColumnStats(classOf[TimestampColumnStats], TIMESTAMP, Row(null, null, 0))
 
   def testColumnStats[T <: NativeType, U <: ColumnStats](

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnTypeSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnTypeSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnTypeSuite.scala
index 4fb1ecf..3f3f35d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnTypeSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnTypeSuite.scala
@@ -18,7 +18,7 @@
 package org.apache.spark.sql.columnar
 
 import java.nio.ByteBuffer
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.scalatest.FunSuite
 
@@ -33,8 +33,8 @@ class ColumnTypeSuite extends FunSuite with Logging {
 
   test("defaultSize") {
     val checks = Map(
-      INT -> 4, SHORT -> 2, LONG -> 8, BYTE -> 1, DOUBLE -> 8, FLOAT -> 4,
-      BOOLEAN -> 1, STRING -> 8, TIMESTAMP -> 12, BINARY -> 16, GENERIC -> 16)
+      INT -> 4, SHORT -> 2, LONG -> 8, BYTE -> 1, DOUBLE -> 8, FLOAT -> 4, BOOLEAN -> 1,
+      STRING -> 8, DATE -> 8, TIMESTAMP -> 12, BINARY -> 16, GENERIC -> 16)
 
     checks.foreach { case (columnType, expectedSize) =>
       assertResult(expectedSize, s"Wrong defaultSize for $columnType") {
@@ -64,6 +64,7 @@ class ColumnTypeSuite extends FunSuite with Logging {
     checkActualSize(FLOAT,     Float.MaxValue,    4)
     checkActualSize(BOOLEAN,   true,              1)
     checkActualSize(STRING,    "hello",           4 + "hello".getBytes("utf-8").length)
+    checkActualSize(DATE,      new Date(0L),      8)
     checkActualSize(TIMESTAMP, new Timestamp(0L), 12)
 
     val binary = Array.fill[Byte](4)(0: Byte)

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnarTestUtils.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnarTestUtils.scala b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnarTestUtils.scala
index 38b04dd..a1f2121 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnarTestUtils.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/columnar/ColumnarTestUtils.scala
@@ -20,7 +20,7 @@ package org.apache.spark.sql.columnar
 import scala.collection.immutable.HashSet
 import scala.util.Random
 
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 
 import org.apache.spark.sql.Row
 import org.apache.spark.sql.catalyst.expressions.GenericMutableRow
@@ -50,6 +50,7 @@ object ColumnarTestUtils {
       case STRING    => Random.nextString(Random.nextInt(32))
       case BOOLEAN   => Random.nextBoolean()
       case BINARY    => randomBytes(Random.nextInt(32))
+      case DATE      => new Date(Random.nextLong())
       case TIMESTAMP =>
         val timestamp = new Timestamp(Random.nextLong())
         timestamp.setNanos(Random.nextInt(999999999))

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnAccessorSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnAccessorSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnAccessorSuite.scala
index 6c9a9ab..21906e3 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnAccessorSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnAccessorSuite.scala
@@ -41,7 +41,9 @@ object TestNullableColumnAccessor {
 class NullableColumnAccessorSuite extends FunSuite {
   import ColumnarTestUtils._
 
-  Seq(INT, LONG, SHORT, BOOLEAN, BYTE, STRING, DOUBLE, FLOAT, BINARY, GENERIC, TIMESTAMP).foreach {
+  Seq(
+    INT, LONG, SHORT, BOOLEAN, BYTE, STRING, DOUBLE, FLOAT, BINARY, GENERIC, DATE, TIMESTAMP
+  ).foreach {
     testNullableColumnAccessor(_)
   }
 

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnBuilderSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnBuilderSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnBuilderSuite.scala
index f54a21e..cb73f3d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnBuilderSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/columnar/NullableColumnBuilderSuite.scala
@@ -37,7 +37,9 @@ object TestNullableColumnBuilder {
 class NullableColumnBuilderSuite extends FunSuite {
   import ColumnarTestUtils._
 
-  Seq(INT, LONG, SHORT, BOOLEAN, BYTE, STRING, DOUBLE, FLOAT, BINARY, GENERIC, TIMESTAMP).foreach {
+  Seq(
+    INT, LONG, SHORT, BOOLEAN, BYTE, STRING, DOUBLE, FLOAT, BINARY, GENERIC, DATE, TIMESTAMP
+  ).foreach {
     testNullableColumnBuilder(_)
   }
 

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/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 35e9c99..4638885 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
@@ -343,6 +343,13 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
     "ct_case_insensitive",
     "database_location",
     "database_properties",
+    "date_2",
+    "date_3",
+    "date_4",
+    "date_comparison",
+    "date_join1",
+    "date_serde",
+    "date_udf",
     "decimal_1",
     "decimal_4",
     "decimal_join",
@@ -604,8 +611,10 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
     "part_inherit_tbl_props",
     "part_inherit_tbl_props_empty",
     "part_inherit_tbl_props_with_star",
+    "partition_date",
     "partition_schema1",
     "partition_serde_format",
+    "partition_type_check",
     "partition_varchar1",
     "partition_wise_fileformat4",
     "partition_wise_fileformat5",
@@ -904,6 +913,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
     "union7",
     "union8",
     "union9",
+    "union_date",
     "union_lateralview",
     "union_ppr",
     "union_remove_11",

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
index fad3b39..8b5a901 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
@@ -18,7 +18,7 @@
 package org.apache.spark.sql.hive
 
 import java.io.{BufferedReader, File, InputStreamReader, PrintStream}
-import java.sql.Timestamp
+import java.sql.{Date, Timestamp}
 import java.util.{ArrayList => JArrayList}
 
 import scala.collection.JavaConversions._
@@ -34,6 +34,7 @@ import org.apache.hadoop.hive.ql.processors._
 import org.apache.hadoop.hive.ql.session.SessionState
 import org.apache.hadoop.hive.ql.stats.StatsSetupConst
 import org.apache.hadoop.hive.serde2.io.TimestampWritable
+import org.apache.hadoop.hive.serde2.io.DateWritable
 
 import org.apache.spark.SparkContext
 import org.apache.spark.rdd.RDD
@@ -357,7 +358,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
 
     protected val primitiveTypes =
       Seq(StringType, IntegerType, LongType, DoubleType, FloatType, BooleanType, ByteType,
-        ShortType, DecimalType, TimestampType, BinaryType)
+        ShortType, DecimalType, DateType, TimestampType, BinaryType)
 
     protected[sql] def toHiveString(a: (Any, DataType)): String = a match {
       case (struct: Row, StructType(fields)) =>
@@ -372,6 +373,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
             toHiveStructString((key, kType)) + ":" + toHiveStructString((value, vType))
         }.toSeq.sorted.mkString("{", ",", "}")
       case (null, _) => "NULL"
+      case (d: Date, DateType) => new DateWritable(d).toString
       case (t: Timestamp, TimestampType) => new TimestampWritable(t).toString
       case (bin: Array[Byte], BinaryType) => new String(bin, "UTF-8")
       case (other, tpe) if primitiveTypes contains tpe => other.toString

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
index d633c42..1977618 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
@@ -39,6 +39,7 @@ private[hive] trait HiveInspectors {
     case c: Class[_] if c == classOf[hiveIo.HiveDecimalWritable] => DecimalType
     case c: Class[_] if c == classOf[hiveIo.ByteWritable] => ByteType
     case c: Class[_] if c == classOf[hiveIo.ShortWritable] => ShortType
+    case c: Class[_] if c == classOf[hiveIo.DateWritable] => DateType
     case c: Class[_] if c == classOf[hiveIo.TimestampWritable] => TimestampType
     case c: Class[_] if c == classOf[hadoopIo.Text] => StringType
     case c: Class[_] if c == classOf[hadoopIo.IntWritable] => IntegerType
@@ -49,6 +50,7 @@ private[hive] trait HiveInspectors {
 
     // java class
     case c: Class[_] if c == classOf[java.lang.String] => StringType
+    case c: Class[_] if c == classOf[java.sql.Date] => DateType
     case c: Class[_] if c == classOf[java.sql.Timestamp] => TimestampType
     case c: Class[_] if c == classOf[HiveDecimal] => DecimalType
     case c: Class[_] if c == classOf[java.math.BigDecimal] => DecimalType
@@ -93,6 +95,7 @@ private[hive] trait HiveInspectors {
       System.arraycopy(b.getBytes(), 0, bytes, 0, b.getLength)
       bytes
     }
+    case d: hiveIo.DateWritable => d.get
     case t: hiveIo.TimestampWritable => t.getTimestamp
     case b: hiveIo.HiveDecimalWritable => BigDecimal(b.getHiveDecimal().bigDecimalValue())
     case list: java.util.List[_] => list.map(unwrap)
@@ -108,6 +111,7 @@ private[hive] trait HiveInspectors {
     case str: String => str
     case p: java.math.BigDecimal => p
     case p: Array[Byte] => p
+    case p: java.sql.Date => p
     case p: java.sql.Timestamp => p
   }
 
@@ -147,6 +151,7 @@ private[hive] trait HiveInspectors {
     case l: Byte => l: java.lang.Byte
     case b: BigDecimal => new HiveDecimal(b.underlying())
     case b: Array[Byte] => b
+    case d: java.sql.Date => d
     case t: java.sql.Timestamp => t
     case s: Seq[_] => seqAsJavaList(s.map(wrap))
     case m: Map[_,_] =>
@@ -173,6 +178,7 @@ private[hive] trait HiveInspectors {
     case ByteType => PrimitiveObjectInspectorFactory.javaByteObjectInspector
     case NullType => PrimitiveObjectInspectorFactory.javaVoidObjectInspector
     case BinaryType => PrimitiveObjectInspectorFactory.javaByteArrayObjectInspector
+    case DateType => PrimitiveObjectInspectorFactory.javaDateObjectInspector
     case TimestampType => PrimitiveObjectInspectorFactory.javaTimestampObjectInspector
     case DecimalType => PrimitiveObjectInspectorFactory.javaHiveDecimalObjectInspector
     case StructType(fields) =>
@@ -211,6 +217,8 @@ private[hive] trait HiveInspectors {
     case _: JavaBinaryObjectInspector => BinaryType
     case _: WritableHiveDecimalObjectInspector => DecimalType
     case _: JavaHiveDecimalObjectInspector => DecimalType
+    case _: WritableDateObjectInspector => DateType
+    case _: JavaDateObjectInspector => DateType
     case _: WritableTimestampObjectInspector => TimestampType
     case _: JavaTimestampObjectInspector => TimestampType
     case _: WritableVoidObjectInspector => NullType
@@ -238,6 +246,7 @@ private[hive] trait HiveInspectors {
       case ShortType => shortTypeInfo
       case StringType => stringTypeInfo
       case DecimalType => decimalTypeInfo
+      case DateType => dateTypeInfo
       case TimestampType => timestampTypeInfo
       case NullType => voidTypeInfo
     }

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
index addd5be..c5fee5e 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
@@ -186,6 +186,7 @@ object HiveMetastoreTypes extends RegexParsers {
     "binary" ^^^ BinaryType |
     "boolean" ^^^ BooleanType |
     "decimal" ^^^ DecimalType |
+    "date" ^^^ DateType |
     "timestamp" ^^^ TimestampType |
     "varchar\\((\\d+)\\)".r ^^^ StringType
 
@@ -235,6 +236,7 @@ object HiveMetastoreTypes extends RegexParsers {
     case LongType => "bigint"
     case BinaryType => "binary"
     case BooleanType => "boolean"
+    case DateType => "date"
     case DecimalType => "decimal"
     case TimestampType => "timestamp"
     case NullType => "void"

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
index 7cc14dc..2b59915 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
@@ -17,6 +17,8 @@
 
 package org.apache.spark.sql.hive
 
+import java.sql.Date
+
 import org.apache.hadoop.hive.ql.lib.Node
 import org.apache.hadoop.hive.ql.parse._
 import org.apache.hadoop.hive.ql.plan.PlanUtils
@@ -317,6 +319,7 @@ private[hive] object HiveQl {
     case Token("TOK_STRING", Nil) => StringType
     case Token("TOK_FLOAT", Nil) => FloatType
     case Token("TOK_DOUBLE", Nil) => DoubleType
+    case Token("TOK_DATE", Nil) => DateType
     case Token("TOK_TIMESTAMP", Nil) => TimestampType
     case Token("TOK_BINARY", Nil) => BinaryType
     case Token("TOK_LIST", elementType :: Nil) => ArrayType(nodeToDataType(elementType))
@@ -924,6 +927,8 @@ private[hive] object HiveQl {
       Cast(nodeToExpr(arg), DecimalType)
     case Token("TOK_FUNCTION", Token("TOK_TIMESTAMP", Nil) :: arg :: Nil) =>
       Cast(nodeToExpr(arg), TimestampType)
+    case Token("TOK_FUNCTION", Token("TOK_DATE", Nil) :: arg :: Nil) =>
+      Cast(nodeToExpr(arg), DateType)
 
     /* Arithmetic */
     case Token("-", child :: Nil) => UnaryMinus(nodeToExpr(child))
@@ -1047,6 +1052,9 @@ private[hive] object HiveQl {
     case ast: ASTNode if ast.getType == HiveParser.StringLiteral =>
       Literal(BaseSemanticAnalyzer.unescapeSQLString(ast.getText))
 
+    case ast: ASTNode if ast.getType == HiveParser.TOK_DATELITERAL =>
+      Literal(Date.valueOf(ast.getText.substring(1, ast.getText.length - 1)))
+
     case a: ASTNode =>
       throw new NotImplementedError(
         s"""No parse rules for ASTNode type: ${a.getType}, text: ${a.getText} :

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-0-23edf29bf7376c70d5ecf12720f4b1eb
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-0-23edf29bf7376c70d5ecf12720f4b1eb b/sql/hive/src/test/resources/golden/date_1-0-23edf29bf7376c70d5ecf12720f4b1eb
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-1-4ebe3571c13a8b0c03096fbd972b7f1b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-1-4ebe3571c13a8b0c03096fbd972b7f1b b/sql/hive/src/test/resources/golden/date_1-1-4ebe3571c13a8b0c03096fbd972b7f1b
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-10-d964bec7e5632091ab5cb6f6786dbbf9
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-10-d964bec7e5632091ab5cb6f6786dbbf9 b/sql/hive/src/test/resources/golden/date_1-10-d964bec7e5632091ab5cb6f6786dbbf9
new file mode 100644
index 0000000..8fb5eda
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-10-d964bec7e5632091ab5cb6f6786dbbf9
@@ -0,0 +1 @@
+2011-01-01	1

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-11-480c5f024a28232b7857be327c992509
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-11-480c5f024a28232b7857be327c992509 b/sql/hive/src/test/resources/golden/date_1-11-480c5f024a28232b7857be327c992509
new file mode 100644
index 0000000..5a368ab
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-11-480c5f024a28232b7857be327c992509
@@ -0,0 +1 @@
+2012-01-01	2011-01-01	2011-01-01 00:00:00	2011-01-01	2011-01-01

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-12-4c0ed7fcb75770d8790575b586bf14f4
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-12-4c0ed7fcb75770d8790575b586bf14f4 b/sql/hive/src/test/resources/golden/date_1-12-4c0ed7fcb75770d8790575b586bf14f4
new file mode 100644
index 0000000..edb4b1f
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-12-4c0ed7fcb75770d8790575b586bf14f4
@@ -0,0 +1 @@
+NULL	NULL	NULL	NULL	NULL	NULL	NULL

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-13-44fc74c1993062c0a9522199ff27fea
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-13-44fc74c1993062c0a9522199ff27fea b/sql/hive/src/test/resources/golden/date_1-13-44fc74c1993062c0a9522199ff27fea
new file mode 100644
index 0000000..2af0b9e
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-13-44fc74c1993062c0a9522199ff27fea
@@ -0,0 +1 @@
+true	true	true	true	true	true	true	true	true	true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-14-4855a66124b16d1d0d003235995ac06b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-14-4855a66124b16d1d0d003235995ac06b b/sql/hive/src/test/resources/golden/date_1-14-4855a66124b16d1d0d003235995ac06b
new file mode 100644
index 0000000..d8dfbf6
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-14-4855a66124b16d1d0d003235995ac06b
@@ -0,0 +1 @@
+2001-01-28	2001-02-28	2001-03-28	2001-04-28	2001-05-28	2001-06-28	2001-07-28	2001-08-28	2001-09-28	2001-10-28	2001-11-28	2001-12-28

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-15-8bc190dba0f641840b5e1e198a14c55b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-15-8bc190dba0f641840b5e1e198a14c55b b/sql/hive/src/test/resources/golden/date_1-15-8bc190dba0f641840b5e1e198a14c55b
new file mode 100644
index 0000000..4f6a1bc
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-15-8bc190dba0f641840b5e1e198a14c55b
@@ -0,0 +1 @@
+true	true	true	true	true	true	true	true	true	true	true	true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-16-23edf29bf7376c70d5ecf12720f4b1eb
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-16-23edf29bf7376c70d5ecf12720f4b1eb b/sql/hive/src/test/resources/golden/date_1-16-23edf29bf7376c70d5ecf12720f4b1eb
new file mode 100644
index 0000000..e69de29

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-3-df16364a220ff96a6ea1cd478cbc1d0b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-3-df16364a220ff96a6ea1cd478cbc1d0b b/sql/hive/src/test/resources/golden/date_1-3-df16364a220ff96a6ea1cd478cbc1d0b
new file mode 100644
index 0000000..963bc42
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-3-df16364a220ff96a6ea1cd478cbc1d0b
@@ -0,0 +1 @@
+2011-01-01

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-4-d964bec7e5632091ab5cb6f6786dbbf9
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-4-d964bec7e5632091ab5cb6f6786dbbf9 b/sql/hive/src/test/resources/golden/date_1-4-d964bec7e5632091ab5cb6f6786dbbf9
new file mode 100644
index 0000000..8fb5eda
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-4-d964bec7e5632091ab5cb6f6786dbbf9
@@ -0,0 +1 @@
+2011-01-01	1

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-6-df16364a220ff96a6ea1cd478cbc1d0b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-6-df16364a220ff96a6ea1cd478cbc1d0b b/sql/hive/src/test/resources/golden/date_1-6-df16364a220ff96a6ea1cd478cbc1d0b
new file mode 100644
index 0000000..963bc42
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-6-df16364a220ff96a6ea1cd478cbc1d0b
@@ -0,0 +1 @@
+2011-01-01

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-7-d964bec7e5632091ab5cb6f6786dbbf9
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-7-d964bec7e5632091ab5cb6f6786dbbf9 b/sql/hive/src/test/resources/golden/date_1-7-d964bec7e5632091ab5cb6f6786dbbf9
new file mode 100644
index 0000000..8fb5eda
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-7-d964bec7e5632091ab5cb6f6786dbbf9
@@ -0,0 +1 @@
+2011-01-01	1

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-8-1d5c58095cd52ea539d869f2ab1ab67d
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-8-1d5c58095cd52ea539d869f2ab1ab67d b/sql/hive/src/test/resources/golden/date_1-8-1d5c58095cd52ea539d869f2ab1ab67d
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_1-9-df16364a220ff96a6ea1cd478cbc1d0b
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_1-9-df16364a220ff96a6ea1cd478cbc1d0b b/sql/hive/src/test/resources/golden/date_1-9-df16364a220ff96a6ea1cd478cbc1d0b
new file mode 100644
index 0000000..963bc42
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_1-9-df16364a220ff96a6ea1cd478cbc1d0b
@@ -0,0 +1 @@
+2011-01-01

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_2-3-eedb73e0a622c2ab760b524f395dd4ba
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_2-3-eedb73e0a622c2ab760b524f395dd4ba b/sql/hive/src/test/resources/golden/date_2-3-eedb73e0a622c2ab760b524f395dd4ba
new file mode 100644
index 0000000..db973ab
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_2-3-eedb73e0a622c2ab760b524f395dd4ba
@@ -0,0 +1,137 @@
+2010-10-20	7291
+2010-10-20	3198
+2010-10-20	3014
+2010-10-20	2630
+2010-10-20	1610
+2010-10-20	1599
+2010-10-20	1531
+2010-10-20	1142
+2010-10-20	1064
+2010-10-20	897
+2010-10-20	361
+2010-10-21	7291
+2010-10-21	3198
+2010-10-21	3014
+2010-10-21	2646
+2010-10-21	2630
+2010-10-21	1610
+2010-10-21	1599
+2010-10-21	1531
+2010-10-21	1142
+2010-10-21	1064
+2010-10-21	897
+2010-10-21	361
+2010-10-22	3198
+2010-10-22	3014
+2010-10-22	2646
+2010-10-22	2630
+2010-10-22	1610
+2010-10-22	1599
+2010-10-22	1531
+2010-10-22	1142
+2010-10-22	1064
+2010-10-22	897
+2010-10-22	361
+2010-10-23	7274
+2010-10-23	5917
+2010-10-23	5904
+2010-10-23	5832
+2010-10-23	3171
+2010-10-23	3085
+2010-10-23	2932
+2010-10-23	1805
+2010-10-23	650
+2010-10-23	426
+2010-10-23	384
+2010-10-23	272
+2010-10-24	7282
+2010-10-24	3198
+2010-10-24	3014
+2010-10-24	2646
+2010-10-24	2630
+2010-10-24	2571
+2010-10-24	2254
+2010-10-24	1610
+2010-10-24	1599
+2010-10-24	1531
+2010-10-24	897
+2010-10-24	361
+2010-10-25	7291
+2010-10-25	3198
+2010-10-25	3014
+2010-10-25	2646
+2010-10-25	2630
+2010-10-25	1610
+2010-10-25	1599
+2010-10-25	1531
+2010-10-25	1142
+2010-10-25	1064
+2010-10-25	897
+2010-10-25	361
+2010-10-26	7291
+2010-10-26	3198
+2010-10-26	3014
+2010-10-26	2662
+2010-10-26	2646
+2010-10-26	2630
+2010-10-26	1610
+2010-10-26	1599
+2010-10-26	1531
+2010-10-26	1142
+2010-10-26	1064
+2010-10-26	897
+2010-10-26	361
+2010-10-27	7291
+2010-10-27	3198
+2010-10-27	3014
+2010-10-27	2630
+2010-10-27	1610
+2010-10-27	1599
+2010-10-27	1531
+2010-10-27	1142
+2010-10-27	1064
+2010-10-27	897
+2010-10-27	361
+2010-10-28	7291
+2010-10-28	3198
+2010-10-28	3014
+2010-10-28	2646
+2010-10-28	2630
+2010-10-28	1610
+2010-10-28	1599
+2010-10-28	1531
+2010-10-28	1142
+2010-10-28	1064
+2010-10-28	897
+2010-10-28	361
+2010-10-29	7291
+2010-10-29	3198
+2010-10-29	3014
+2010-10-29	2646
+2010-10-29	2630
+2010-10-29	1610
+2010-10-29	1599
+2010-10-29	1531
+2010-10-29	1142
+2010-10-29	1064
+2010-10-29	897
+2010-10-29	361
+2010-10-30	5917
+2010-10-30	5904
+2010-10-30	3171
+2010-10-30	3085
+2010-10-30	2932
+2010-10-30	2018
+2010-10-30	1805
+2010-10-30	650
+2010-10-30	426
+2010-10-30	384
+2010-10-30	272
+2010-10-31	7282
+2010-10-31	3198
+2010-10-31	2571
+2010-10-31	1610
+2010-10-31	1599
+2010-10-31	1531
+2010-10-31	897
+2010-10-31	361

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_2-4-3618dfde8da7c26f03bca72970db9ef7
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_2-4-3618dfde8da7c26f03bca72970db9ef7 b/sql/hive/src/test/resources/golden/date_2-4-3618dfde8da7c26f03bca72970db9ef7
new file mode 100644
index 0000000..1b0ea7b
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_2-4-3618dfde8da7c26f03bca72970db9ef7
@@ -0,0 +1,137 @@
+2010-10-31	361
+2010-10-31	897
+2010-10-31	1531
+2010-10-31	1599
+2010-10-31	1610
+2010-10-31	2571
+2010-10-31	3198
+2010-10-31	7282
+2010-10-30	272
+2010-10-30	384
+2010-10-30	426
+2010-10-30	650
+2010-10-30	1805
+2010-10-30	2018
+2010-10-30	2932
+2010-10-30	3085
+2010-10-30	3171
+2010-10-30	5904
+2010-10-30	5917
+2010-10-29	361
+2010-10-29	897
+2010-10-29	1064
+2010-10-29	1142
+2010-10-29	1531
+2010-10-29	1599
+2010-10-29	1610
+2010-10-29	2630
+2010-10-29	2646
+2010-10-29	3014
+2010-10-29	3198
+2010-10-29	7291
+2010-10-28	361
+2010-10-28	897
+2010-10-28	1064
+2010-10-28	1142
+2010-10-28	1531
+2010-10-28	1599
+2010-10-28	1610
+2010-10-28	2630
+2010-10-28	2646
+2010-10-28	3014
+2010-10-28	3198
+2010-10-28	7291
+2010-10-27	361
+2010-10-27	897
+2010-10-27	1064
+2010-10-27	1142
+2010-10-27	1531
+2010-10-27	1599
+2010-10-27	1610
+2010-10-27	2630
+2010-10-27	3014
+2010-10-27	3198
+2010-10-27	7291
+2010-10-26	361
+2010-10-26	897
+2010-10-26	1064
+2010-10-26	1142
+2010-10-26	1531
+2010-10-26	1599
+2010-10-26	1610
+2010-10-26	2630
+2010-10-26	2646
+2010-10-26	2662
+2010-10-26	3014
+2010-10-26	3198
+2010-10-26	7291
+2010-10-25	361
+2010-10-25	897
+2010-10-25	1064
+2010-10-25	1142
+2010-10-25	1531
+2010-10-25	1599
+2010-10-25	1610
+2010-10-25	2630
+2010-10-25	2646
+2010-10-25	3014
+2010-10-25	3198
+2010-10-25	7291
+2010-10-24	361
+2010-10-24	897
+2010-10-24	1531
+2010-10-24	1599
+2010-10-24	1610
+2010-10-24	2254
+2010-10-24	2571
+2010-10-24	2630
+2010-10-24	2646
+2010-10-24	3014
+2010-10-24	3198
+2010-10-24	7282
+2010-10-23	272
+2010-10-23	384
+2010-10-23	426
+2010-10-23	650
+2010-10-23	1805
+2010-10-23	2932
+2010-10-23	3085
+2010-10-23	3171
+2010-10-23	5832
+2010-10-23	5904
+2010-10-23	5917
+2010-10-23	7274
+2010-10-22	361
+2010-10-22	897
+2010-10-22	1064
+2010-10-22	1142
+2010-10-22	1531
+2010-10-22	1599
+2010-10-22	1610
+2010-10-22	2630
+2010-10-22	2646
+2010-10-22	3014
+2010-10-22	3198
+2010-10-21	361
+2010-10-21	897
+2010-10-21	1064
+2010-10-21	1142
+2010-10-21	1531
+2010-10-21	1599
+2010-10-21	1610
+2010-10-21	2630
+2010-10-21	2646
+2010-10-21	3014
+2010-10-21	3198
+2010-10-21	7291
+2010-10-20	361
+2010-10-20	897
+2010-10-20	1064
+2010-10-20	1142
+2010-10-20	1531
+2010-10-20	1599
+2010-10-20	1610
+2010-10-20	2630
+2010-10-20	3014
+2010-10-20	3198
+2010-10-20	7291

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_2-5-fe9bebfc8994ddd8d7cd0208c1f0af3c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_2-5-fe9bebfc8994ddd8d7cd0208c1f0af3c b/sql/hive/src/test/resources/golden/date_2-5-fe9bebfc8994ddd8d7cd0208c1f0af3c
new file mode 100644
index 0000000..0f2a6f7
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_2-5-fe9bebfc8994ddd8d7cd0208c1f0af3c
@@ -0,0 +1,12 @@
+2010-10-20	11
+2010-10-21	12
+2010-10-22	11
+2010-10-23	12
+2010-10-24	12
+2010-10-25	12
+2010-10-26	13
+2010-10-27	11
+2010-10-28	12
+2010-10-29	12
+2010-10-30	11
+2010-10-31	8

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_3-3-4cf49e71b636df754871a675f9e4e24
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_3-3-4cf49e71b636df754871a675f9e4e24 b/sql/hive/src/test/resources/golden/date_3-3-4cf49e71b636df754871a675f9e4e24
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_3-4-e009f358964f6d1236cfc03283e2b06f
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_3-4-e009f358964f6d1236cfc03283e2b06f b/sql/hive/src/test/resources/golden/date_3-4-e009f358964f6d1236cfc03283e2b06f
new file mode 100644
index 0000000..66d2220
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_3-4-e009f358964f6d1236cfc03283e2b06f
@@ -0,0 +1 @@
+1	2011-01-01

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_4-1-6272f5e518f6a20bc96a5870ff315c4f
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_4-1-6272f5e518f6a20bc96a5870ff315c4f b/sql/hive/src/test/resources/golden/date_4-1-6272f5e518f6a20bc96a5870ff315c4f
new file mode 100644
index 0000000..e69de29

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

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_4-4-bee09a7384666043621f68297cee2e68
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_4-4-bee09a7384666043621f68297cee2e68 b/sql/hive/src/test/resources/golden/date_4-4-bee09a7384666043621f68297cee2e68
new file mode 100644
index 0000000..b61affd
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_4-4-bee09a7384666043621f68297cee2e68
@@ -0,0 +1 @@
+2011-01-01	2011-01-01

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

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-0-69eec445bd045c9dc899fafa348d8495
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-0-69eec445bd045c9dc899fafa348d8495 b/sql/hive/src/test/resources/golden/date_comparison-0-69eec445bd045c9dc899fafa348d8495
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-0-69eec445bd045c9dc899fafa348d8495
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-1-fcc400871a502009c8680509e3869ec1
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-1-fcc400871a502009c8680509e3869ec1 b/sql/hive/src/test/resources/golden/date_comparison-1-fcc400871a502009c8680509e3869ec1
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-1-fcc400871a502009c8680509e3869ec1
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-10-a9f2560c273163e11306d4f1dd1d9d54
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-10-a9f2560c273163e11306d4f1dd1d9d54 b/sql/hive/src/test/resources/golden/date_comparison-10-a9f2560c273163e11306d4f1dd1d9d54
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-10-a9f2560c273163e11306d4f1dd1d9d54
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-11-4a7bac9ddcf40db6329faaec8e426543
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-11-4a7bac9ddcf40db6329faaec8e426543 b/sql/hive/src/test/resources/golden/date_comparison-11-4a7bac9ddcf40db6329faaec8e426543
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-11-4a7bac9ddcf40db6329faaec8e426543
@@ -0,0 +1 @@
+true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-2-b8598a4d0c948c2ddcf3eeef0abf2264
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-2-b8598a4d0c948c2ddcf3eeef0abf2264 b/sql/hive/src/test/resources/golden/date_comparison-2-b8598a4d0c948c2ddcf3eeef0abf2264
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-2-b8598a4d0c948c2ddcf3eeef0abf2264
@@ -0,0 +1 @@
+true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-3-14d35f266be9cceb11a2ae09ec8b3835
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-3-14d35f266be9cceb11a2ae09ec8b3835 b/sql/hive/src/test/resources/golden/date_comparison-3-14d35f266be9cceb11a2ae09ec8b3835
new file mode 100644
index 0000000..c508d53
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-3-14d35f266be9cceb11a2ae09ec8b3835
@@ -0,0 +1 @@
+false

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-4-c8865b14d53f2c2496fb69ee8191bf37
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-4-c8865b14d53f2c2496fb69ee8191bf37 b/sql/hive/src/test/resources/golden/date_comparison-4-c8865b14d53f2c2496fb69ee8191bf37
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-4-c8865b14d53f2c2496fb69ee8191bf37
@@ -0,0 +1 @@
+true

http://git-wip-us.apache.org/repos/asf/spark/blob/2ac40da3/sql/hive/src/test/resources/golden/date_comparison-5-f2c907e64da8166a731ddc0ed19bad6c
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/resources/golden/date_comparison-5-f2c907e64da8166a731ddc0ed19bad6c b/sql/hive/src/test/resources/golden/date_comparison-5-f2c907e64da8166a731ddc0ed19bad6c
new file mode 100644
index 0000000..27ba77d
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/date_comparison-5-f2c907e64da8166a731ddc0ed19bad6c
@@ -0,0 +1 @@
+true


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org