Skip to content
Permalink
Browse files

[SPARK-30179][SQL][TESTS] Improve test in SingleSessionSuite

### What changes were proposed in this pull request?

improve the temporary functions test in SingleSessionSuite by verifying the result in a query

### Why are the changes needed?

### Does this PR introduce any user-facing change?

### How was this patch tested?

Closes #26812 from leoluan2009/SPARK-30179.

Authored-by: Luan <xuluan@ebay.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
  • Loading branch information
Luan authored and HyukjinKwon committed Dec 10, 2019
1 parent 36fa198 commit 3d98c9f9854c6078d0784d3aa5cc1bb4b5e6a8e8
@@ -790,6 +790,8 @@ class SingleSessionSuite extends HiveThriftJdbcTest {
Seq(
"SET foo=bar",
s"ADD JAR $jarURL",
"CREATE TABLE test_udtf(key INT, value STRING) USING hive",
s"LOAD DATA LOCAL INPATH '${TestData.smallKv}' OVERWRITE INTO TABLE test_udtf",
s"""CREATE TEMPORARY FUNCTION udtf_count2
|AS 'org.apache.spark.sql.hive.execution.GenericUDTFCount2'
""".stripMargin
@@ -816,6 +818,16 @@ class SingleSessionSuite extends HiveThriftJdbcTest {

assert(rs2.next())
assert(rs2.getString(1) === "Usage: N/A.")

val rs3 = statement.executeQuery(
"SELECT key, cc FROM test_udtf LATERAL VIEW udtf_count2(value) dd AS cc")
assert(rs3.next())
assert(rs3.getInt(1) === 165)
assert(rs3.getInt(2) === 5)

assert(rs3.next())
assert(rs3.getInt(1) === 165)
assert(rs3.getInt(2) === 5)
} finally {
statement.executeQuery("DROP TEMPORARY FUNCTION udtf_count2")
}

0 comments on commit 3d98c9f

Please sign in to comment.
You can’t perform that action at this time.