Skip to content

Commit 4dfc412

Browse files
committed
fix tests
1 parent aaa9508 commit 4dfc412

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package org.apache.spark.sql
1919

2020
import org.scalatest.BeforeAndAfterAll
2121

22+
import java.sql.Timestamp
23+
2224
import org.apache.spark.sql.catalyst.DefaultParserDialect
2325
import org.apache.spark.sql.catalyst.errors.DialectException
2426
import org.apache.spark.sql.execution.GeneratedAggregate
@@ -345,8 +347,10 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll with SQLTestUtils {
345347
}
346348

347349
test("SPARK-3173 Timestamp support in the parser") {
350+
(0 to 3).map(i => Tuple1(new Timestamp(i))).toDF("time").registerTempTable("timestamps")
351+
348352
checkAnswer(sql(
349-
"SELECT time FROM timestamps WHERE time='1969-12-31 16:00:00.0'"),
353+
"SELECT time FROM timestamps WHERE time='1969-12-31 16:00:00'"),
350354
Row(java.sql.Timestamp.valueOf("1969-12-31 16:00:00")))
351355

352356
checkAnswer(sql(

sql/core/src/test/scala/org/apache/spark/sql/TestData.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,6 @@ object TestData {
174174
"3, C3, true, null" ::
175175
"4, D4, true, 2147483644" :: Nil)
176176

177-
case class TimestampField(time: Timestamp)
178-
val timestamps = TestSQLContext.sparkContext.parallelize((0 to 3).map { i =>
179-
TimestampField(new Timestamp(i))
180-
})
181-
timestamps.toDF().registerTempTable("timestamps")
182-
183177
case class IntField(i: Int)
184178
// An RDD with 4 elements and 8 partitions
185179
val withEmptyParts = TestSQLContext.sparkContext.parallelize((1 to 4).map(IntField), 8)

sql/core/src/test/scala/org/apache/spark/sql/columnar/InMemoryColumnarQuerySuite.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ class InMemoryColumnarQuerySuite extends QueryTest {
9191
}
9292

9393
test("SPARK-2729 regression: timestamp data type") {
94+
val timestamps = (0 to 3).map(i => Tuple1(new Timestamp(i))).toDF("time")
9495
checkAnswer(
9596
sql("SELECT time FROM timestamps"),
96-
timestamps.collect().toSeq.map(Row.fromTuple))
97+
timestamps.collect().toSeq)
9798

9899
ctx.cacheTable("timestamps")
99100

100101
checkAnswer(
101102
sql("SELECT time FROM timestamps"),
102-
timestamps.collect().toSeq.map(Row.fromTuple))
103+
timestamps.collect().toSeq)
103104
}
104105

105106
test("SPARK-3320 regression: batched column buffer building should work with empty partitions") {

0 commit comments

Comments
 (0)