Skip to content

Commit

Permalink
Replace redundant tests with for loops
Browse files Browse the repository at this point in the history
Signed-off-by: Partho Sarthi <[email protected]>
  • Loading branch information
parthosa committed Nov 20, 2023
1 parent 72ecec4 commit 99efae2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,74 +153,27 @@ class PluginTypeCheckerSuite extends FunSuite with Logging {
assert(result(2) == "ORC")
}

test("supported operator score from onprem") {
val platform = PlatformFactory.createInstance(PlatformNames.ONPREM)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 3.0)
assert(checker.getSpeedupFactor("Ceil") == 4)
}

test("supported operator score from dataproc-t4") {
val platform = PlatformFactory.createInstance(PlatformNames.DATAPROC_T4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 4.88)
assert(checker.getSpeedupFactor("Ceil") == 4.88)
}

test("supported operator score from emr-t4") {
val platform = PlatformFactory.createInstance(PlatformNames.EMR_T4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 2.07)
assert(checker.getSpeedupFactor("Ceil") == 2.07)
}

test("supported operator score from databricks-aws") {
val platform = PlatformFactory.createInstance(PlatformNames.DATABRICKS_AWS)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 2.45)
assert(checker.getSpeedupFactor("Ceil") == 2.45)
}

test("supported operator score from databricks-azure") {
val platform = PlatformFactory.createInstance(PlatformNames.DATABRICKS_AZURE)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 2.73)
assert(checker.getSpeedupFactor("Ceil") == 2.73)
}

test("supported operator score from dataproc-serverless-l4") {
val platform = PlatformFactory.createInstance(PlatformNames.DATAPROC_SL_L4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("WindowExec") == 4.25)
assert(checker.getSpeedupFactor("Ceil") == 4.25)
}

test("supported operator score from dataproc-l4") {
val platform = PlatformFactory.createInstance(PlatformNames.DATAPROC_L4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 4.16)
assert(checker.getSpeedupFactor("Ceil") == 4.16)
}

test("supported operator score from dataproc-gke-t4") {
val platform = PlatformFactory.createInstance(PlatformNames.DATAPROC_GKE_T4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("WindowExec") == 3.65)
assert(checker.getSpeedupFactor("Ceil") == 3.65)
}

test("supported operator score from dataproc-gke-l4") {
val platform = PlatformFactory.createInstance(PlatformNames.DATAPROC_GKE_L4)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("WindowExec") == 3.74)
assert(checker.getSpeedupFactor("Ceil") == 3.74)
}

test("supported operator score from emr-a10") {
val platform = PlatformFactory.createInstance(PlatformNames.EMR_A10)
val checker = new PluginTypeChecker(platform)
assert(checker.getSpeedupFactor("UnionExec") == 2.59)
assert(checker.getSpeedupFactor("Ceil") == 2.59)
val platformSpeedupEntries: Seq[(String, Map[String, Double])] = Seq(
(PlatformNames.ONPREM, Map("UnionExec" -> 3.0, "Ceil" -> 4.0)),
(PlatformNames.DATAPROC_T4, Map("UnionExec" -> 4.88, "Ceil" -> 4.88)),
(PlatformNames.EMR_T4, Map("UnionExec" -> 2.07, "Ceil" -> 2.07)),
(PlatformNames.DATABRICKS_AWS, Map("UnionExec" -> 2.45, "Ceil" -> 2.45)),
(PlatformNames.DATABRICKS_AZURE, Map("UnionExec" -> 2.73, "Ceil" -> 2.73)),
(PlatformNames.DATAPROC_SL_L4, Map("WindowExec" -> 4.25, "Ceil" -> 4.25)),
(PlatformNames.DATAPROC_L4, Map("UnionExec" -> 4.16, "Ceil" -> 4.16)),
(PlatformNames.DATAPROC_GKE_T4, Map("WindowExec" -> 3.65, "Ceil" -> 3.65)),
(PlatformNames.DATAPROC_GKE_L4, Map("WindowExec" -> 3.74, "Ceil" -> 3.74)),
(PlatformNames.EMR_A10, Map("UnionExec" -> 2.59, "Ceil" -> 2.59)),
)

platformSpeedupEntries.foreach { case (platformName, speedupMap) =>
test(s"supported operator score from $platformName") {
val platform = PlatformFactory.createInstance(platformName)
val checker = new PluginTypeChecker(platform)
speedupMap.foreach { case (operator, speedup) =>
assert(checker.getSpeedupFactor(operator) == speedup)
}
}
}

test("supported operator score from custom speedup factor file") {
Expand Down
Loading

0 comments on commit 99efae2

Please sign in to comment.