Skip to content

Commit

Permalink
[SPARK-21832][TEST] Merge SQLBuilderTest into ExpressionSQLBuilderSuite
Browse files Browse the repository at this point in the history
## 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 <dongjoon@apache.org>

Closes apache#19044 from dongjoon-hyun/SPARK-21832.
  • Loading branch information
dongjoon-hyun authored and gatorsmile committed Aug 25, 2017
1 parent de7af29 commit 1f24cee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,29 @@ package org.apache.spark.sql.catalyst

import java.sql.Timestamp

import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.catalyst.dsl.expressions._
import org.apache.spark.sql.catalyst.expressions.{If, Literal, SpecifiedWindowFrame, TimeAdd,
TimeSub, WindowSpecDefinition}
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.hive.test.TestHiveSingleton
import org.apache.spark.unsafe.types.CalendarInterval

class ExpressionSQLBuilderSuite extends SQLBuilderTest {
class ExpressionSQLBuilderSuite extends QueryTest with TestHiveSingleton {
protected def checkSQL(e: Expression, expectedSQL: String): Unit = {
val actualSQL = e.sql
try {
assert(actualSQL == expectedSQL)
} catch {
case cause: Throwable =>
fail(
s"""Wrong SQL generated for the following expression:
|
|${e.prettyName}
|
|$cause
""".stripMargin)
}
}

test("literal") {
checkSQL(Literal("foo"), "'foo'")
checkSQL(Literal("\"foo\""), "'\"foo\"'")
Expand Down

This file was deleted.

0 comments on commit 1f24cee

Please sign in to comment.