Skip to content

Commit

Permalink
make PartitionPreservingOperationSpec work with Spark 3.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yitao Li <[email protected]>
  • Loading branch information
yitao-li committed May 22, 2020
1 parent a51cef0 commit 0c2529a
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,31 @@ class PartitionPreservingOperationSpec extends FlintSuite with FlintTestData {
assert(leafExecutedPlan(data).isInstanceOf[ExternalRDDScanExec[_]])
data.cache()
data.count()
// first node is WholeStageCodegen
assert(executedPlan(data).children.head.isInstanceOf[InMemoryTableScanExec])
if (data.sparkSession.version < "3.0.0") {
// first node is WholeStageCodegen
assert(executedPlan(data).children.head.isInstanceOf[InMemoryTableScanExec])
} else {
val plan = executedPlan(data)
assert(plan.children.head.isInstanceOf[ColumnarToRowExec])
assert(plan.children.head.children.head.isInstanceOf[InputAdapter])
assert(plan.children.head.children.head.children.head.isInstanceOf[InMemoryTableScanExec])
}
assert(leafExecutedPlan(data).isInstanceOf[InMemoryTableScanExec])
data.unpersist()

val orderedData = data.orderBy("time")
orderedData.cache()
orderedData.count()
// first node is WholeStageCodegen
assert(executedPlan(orderedData).children.head.isInstanceOf[InMemoryTableScanExec])
assert(leafExecutedPlan(orderedData).isInstanceOf[InMemoryTableScanExec])
if (data.sparkSession.version < "3.0.0") {
// first node is WholeStageCodegen
assert(executedPlan(orderedData).children.head.isInstanceOf[InMemoryTableScanExec])
assert(leafExecutedPlan(orderedData).isInstanceOf[InMemoryTableScanExec])
} else {
val plan = executedPlan(orderedData)
assert(plan.children.head.isInstanceOf[ColumnarToRowExec])
assert(plan.children.head.children.head.isInstanceOf[InputAdapter])
assert(plan.children.head.children.head.children.head.isInstanceOf[InMemoryTableScanExec])
}
orderedData.unpersist()
}

Expand Down

0 comments on commit 0c2529a

Please sign in to comment.