Skip to content

Commit

Permalink
chore: Fix NPE when running CometTPCHQueriesList directly (apache#285)
Browse files Browse the repository at this point in the history
* chore: Fix NPE when running CometTPCHQueriesList directly

* fix match error.
  • Loading branch information
advancedxy authored and Steve Vaughan Jr committed Apr 21, 2024
1 parent 32b32a1 commit 123bcae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ object CometTPCHQueriesList extends CometTPCQueryListBase with CometTPCQueryBase

// List of all TPC-H queries
val tpchQueries = (1 to 22).map(n => s"q$n")
// Only q1 in the extended queries
val tpchExtendedQueries = Seq("q1")

// If `--query-filter` defined, filters the queries that this option selects
val queries = filterQueries(tpchQueries, benchmarkArgs.queryFilter)
val extendedQueries = filterQueries(tpchExtendedQueries, benchmarkArgs.queryFilter)

if (queries.isEmpty) {
throw new RuntimeException(
Expand All @@ -63,6 +66,6 @@ object CometTPCHQueriesList extends CometTPCQueryListBase with CometTPCQueryBase
setupCBO(cometSpark, benchmarkArgs.cboEnabled, tables)

runQueries("tpch", queries, " TPCH Snappy")
runQueries("tpch-extended", queries, " TPCH Extended Snappy")
runQueries("tpch-extended", extendedQueries, " TPCH Extended Snappy")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ trait CometTPCQueryListBase

val df = cometSpark.sql(queryString)
val cometPlans = mutable.HashSet.empty[String]
stripAQEPlan(df.queryExecution.executedPlan).foreach { case op: CometExec =>
cometPlans += s"${op.nodeName}"
stripAQEPlan(df.queryExecution.executedPlan).foreach {
case op: CometExec =>
cometPlans += s"${op.nodeName}"
case _ =>
}

if (cometPlans.nonEmpty) {
Expand Down

0 comments on commit 123bcae

Please sign in to comment.