Skip to content

Commit

Permalink
Address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed May 17, 2018
1 parent b317777 commit f41fc14
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -18,6 +18,7 @@
package org.apache.spark.sql.execution.debug

import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.functions._
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.sql.test.SQLTestData.TestData

Expand All @@ -33,14 +34,17 @@ class DebuggingSuite extends SparkFunSuite with SharedSQLContext {
}

test("debugCodegen") {
val res = codegenString(spark.range(10).groupBy("id").count().queryExecution.executedPlan)
assert(res.contains("Subtree 1 / 1"))
val res = codegenString(spark.range(10).groupBy(col("id") * 2).count()
.queryExecution.executedPlan)
assert(res.contains("Subtree 1 / 2"))
assert(res.contains("Subtree 2 / 2"))
assert(res.contains("Object[]"))
}

test("debugCodegenStringSeq") {
val res = codegenStringSeq(spark.range(10).groupBy("id").count().queryExecution.executedPlan)
assert(res.length == 1)
val res = codegenStringSeq(spark.range(10).groupBy(col("id") * 2).count()
.queryExecution.executedPlan)
assert(res.length == 2)
assert(res.forall{ case (subtree, code) =>
subtree.contains("Range") && code.contains("Object[]")})
}
Expand Down

0 comments on commit f41fc14

Please sign in to comment.