[SPARK-2729][SQL] Added test case for SPARK-2729
This is a follow up of #1636. Author: Cheng Lian <lian.cs.zju@gmail.com> Closes #1738 from liancheng/test-for-spark-2729 and squashes the following commits: b13692a [Cheng Lian] Added test case for SPARK-2729
This commit is contained in:
parent
198df11f1a
commit
866cf1f822
|
@ -17,11 +17,13 @@
|
|||
|
||||
package org.apache.spark.sql
|
||||
|
||||
import java.sql.Timestamp
|
||||
|
||||
import org.apache.spark.sql.catalyst.plans.logical
|
||||
import org.apache.spark.sql.test._
|
||||
|
||||
/* Implicits */
|
||||
import TestSQLContext._
|
||||
import org.apache.spark.sql.test.TestSQLContext._
|
||||
|
||||
case class TestData(key: Int, value: String)
|
||||
|
||||
|
@ -143,4 +145,10 @@ object TestData {
|
|||
"2, B2, false, null" ::
|
||||
"3, C3, true, null" ::
|
||||
"4, D4, true, 2147483644" :: Nil)
|
||||
|
||||
case class TimestampField(time: Timestamp)
|
||||
val timestamps = TestSQLContext.sparkContext.parallelize((1 to 3).map { i =>
|
||||
TimestampField(new Timestamp(i))
|
||||
})
|
||||
timestamps.registerAsTable("timestamps")
|
||||
}
|
||||
|
|
|
@ -73,4 +73,16 @@ class InMemoryColumnarQuerySuite extends QueryTest {
|
|||
sql("SELECT * FROM nullableRepeatedData"),
|
||||
nullableRepeatedData.collect().toSeq)
|
||||
}
|
||||
|
||||
test("SPARK-2729 regression: timestamp data type") {
|
||||
checkAnswer(
|
||||
sql("SELECT time FROM timestamps"),
|
||||
timestamps.collect().toSeq)
|
||||
|
||||
TestSQLContext.cacheTable("timestamps")
|
||||
|
||||
checkAnswer(
|
||||
sql("SELECT time FROM timestamps"),
|
||||
timestamps.collect().toSeq)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue