Skip to content

Commit

Permalink
Rename ConvertFromUnsafe -> ConvertToSafe
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Jul 18, 2015
1 parent 0e2d548 commit 08ce199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ case class ConvertToUnsafe(child: SparkPlan) extends UnaryNode {
* Converts [[UnsafeRow]]s back into Java-object-based rows.
*/
@DeveloperApi
case class ConvertFromUnsafe(child: SparkPlan) extends UnaryNode {
case class ConvertToSafe(child: SparkPlan) extends UnaryNode {
override def output: Seq[Attribute] = child.output
override def outputsUnsafeRows: Boolean = false
override def canProcessUnsafeRows: Boolean = true
Expand Down Expand Up @@ -75,7 +75,7 @@ private[sql] object EnsureRowFormats extends Rule[SparkPlan] {
if (operator.children.exists(_.outputsUnsafeRows)) {
operator.withNewChildren {
operator.children.map {
c => if (c.outputsUnsafeRows) ConvertFromUnsafe(c) else c
c => if (c.outputsUnsafeRows) ConvertToSafe(c) else c
}
}
} else {
Expand All @@ -97,7 +97,7 @@ private[sql] object EnsureRowFormats extends Rule[SparkPlan] {
// to safe rows
operator.withNewChildren {
operator.children.map {
c => if (c.outputsUnsafeRows) ConvertFromUnsafe(c) else c
c => if (c.outputsUnsafeRows) ConvertToSafe(c) else c
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RowFormatConvertersSuite extends SparkFunSuite {

private def getConverters(plan: SparkPlan): Seq[SparkPlan] = plan.collect {
case c: ConvertToUnsafe => c
case c: ConvertFromUnsafe => c
case c: ConvertToSafe => c
}

private val outputsSafe = ExternalSort(Nil, false, PhysicalRDD(Seq.empty, null))
Expand All @@ -36,7 +36,7 @@ class RowFormatConvertersSuite extends SparkFunSuite {
test("planner should insert unsafe->safe conversions when required") {
val plan = Limit(10, outputsUnsafe)
val preparedPlan = TestSQLContext.prepareForExecution.execute(plan)
assert(preparedPlan.children.head.isInstanceOf[ConvertFromUnsafe])
assert(preparedPlan.children.head.isInstanceOf[ConvertToSafe])
}

test("filter can process unsafe rows") {
Expand Down

0 comments on commit 08ce199

Please sign in to comment.