Skip to content

Commit

Permalink
add showProgress with jobInfo Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuan1223 committed Oct 17, 2023
1 parent a973cdd commit d12046d
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SQLOperationListenerSuite extends WithSparkSQLEngine with HiveJDBCTestHelp

override protected def jdbcUrl: String = getJdbcUrl

test("operation listener with progress job info") {
val sql = "SELECT java_method('java.lang.Thread', 'sleep', 10000l) FROM range(1, 3, 1, 2);"
test("operation listener") {
val sql = "select /*+ REPARTITION(3, a) */ a from values(1) t(a);"
withSessionHandle { (client, handle) =>
val req = new TExecuteStatementReq()
req.setSessionHandle(handle)
Expand All @@ -48,13 +48,17 @@ class SQLOperationListenerSuite extends WithSparkSQLEngine with HiveJDBCTestHelp
eventually(timeout(90.seconds), interval(500.milliseconds)) {
val resultsResp = client.FetchResults(fetchResultsReq)
val logs = resultsResp.getResults.getColumns.get(0).getStringVal.getValues.asScala
assert(logs.exists(_.matches(".*\\[Job .* Stages\\] \\[Stage .*\\]")))
assert(logs.exists(_.contains("started with 2 stages")))
assert(logs.exists(_.contains("started with 1 tasks")))
assert(logs.exists(_.contains("started with 3 tasks")))
assert(logs.exists(_.contains("Finished stage:")))
assert(logs.exists(_.contains(s"Job ${0 + initJobId} succeeded")))
}
}
}

test("operation listener") {
val sql = "select /*+ REPARTITION(3, a) */ a from values(1) t(a);"
test("operation listener with progress job info") {
val sql = "SELECT java_method('java.lang.Thread', 'sleep', 10000l) FROM range(1, 3, 1, 2);"
withSessionHandle { (client, handle) =>
val req = new TExecuteStatementReq()
req.setSessionHandle(handle)
Expand All @@ -66,11 +70,7 @@ class SQLOperationListenerSuite extends WithSparkSQLEngine with HiveJDBCTestHelp
eventually(timeout(90.seconds), interval(500.milliseconds)) {
val resultsResp = client.FetchResults(fetchResultsReq)
val logs = resultsResp.getResults.getColumns.get(0).getStringVal.getValues.asScala
assert(logs.exists(_.contains("started with 2 stages")))
assert(logs.exists(_.contains("started with 1 tasks")))
assert(logs.exists(_.contains("started with 3 tasks")))
assert(logs.exists(_.contains("Finished stage:")))
assert(logs.exists(_.contains(s"Job ${0 + initJobId} succeeded")))
assert(logs.exists(_.matches(".*\\[Job .* Stages\\] \\[Stage .*\\]")))
}
}
}
Expand Down

0 comments on commit d12046d

Please sign in to comment.