Skip to content

Commit 1f24cee

Browse files
dongjoon-hyungatorsmile
authored andcommitted
[SPARK-21832][TEST] Merge SQLBuilderTest into ExpressionSQLBuilderSuite
## What changes were proposed in this pull request? After [SPARK-19025](apache#16869), there is no need to keep SQLBuilderTest. ExpressionSQLBuilderSuite is the only place to use it. This PR aims to remove SQLBuilderTest. ## How was this patch tested? Pass the updated `ExpressionSQLBuilderSuite`. Author: Dongjoon Hyun <[email protected]> Closes apache#19044 from dongjoon-hyun/SPARK-21832.
1 parent de7af29 commit 1f24cee

File tree

2 files changed

+20
-47
lines changed

2 files changed

+20
-47
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,29 @@ package org.apache.spark.sql.catalyst
1919

2020
import java.sql.Timestamp
2121

22+
import org.apache.spark.sql.QueryTest
2223
import org.apache.spark.sql.catalyst.dsl.expressions._
23-
import org.apache.spark.sql.catalyst.expressions.{If, Literal, SpecifiedWindowFrame, TimeAdd,
24-
TimeSub, WindowSpecDefinition}
24+
import org.apache.spark.sql.catalyst.expressions._
25+
import org.apache.spark.sql.hive.test.TestHiveSingleton
2526
import org.apache.spark.unsafe.types.CalendarInterval
2627

27-
class ExpressionSQLBuilderSuite extends SQLBuilderTest {
28+
class ExpressionSQLBuilderSuite extends QueryTest with TestHiveSingleton {
29+
protected def checkSQL(e: Expression, expectedSQL: String): Unit = {
30+
val actualSQL = e.sql
31+
try {
32+
assert(actualSQL == expectedSQL)
33+
} catch {
34+
case cause: Throwable =>
35+
fail(
36+
s"""Wrong SQL generated for the following expression:
37+
|
38+
|${e.prettyName}
39+
|
40+
|$cause
41+
""".stripMargin)
42+
}
43+
}
44+
2845
test("literal") {
2946
checkSQL(Literal("foo"), "'foo'")
3047
checkSQL(Literal("\"foo\""), "'\"foo\"'")

sql/hive/src/test/scala/org/apache/spark/sql/catalyst/SQLBuilderTest.scala

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)