Skip to content

Commit

Permalink
Correctly handle self joins of in-memory cached tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Apr 3, 2014
1 parent 69e195e commit 87211ce
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.apache.spark.sql.catalyst.analysis.MultiInstanceRelation
import org.apache.spark.sql.catalyst.expressions.GenericRow
import org.apache.spark.sql.catalyst.plans.{QueryPlan, logical}
import org.apache.spark.sql.catalyst.plans.physical._
import org.apache.spark.sql.columnar.InMemoryColumnarTableScan

abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging {
self: Product =>
Expand Down Expand Up @@ -69,6 +70,8 @@ case class SparkLogicalPlan(alreadyPlanned: SparkPlan)
SparkLogicalPlan(
alreadyPlanned match {
case ExistingRdd(output, rdd) => ExistingRdd(output.map(_.newInstance), rdd)
case InMemoryColumnarTableScan(output, child) =>
InMemoryColumnarTableScan(output.map(_.newInstance), child)
case _ => sys.error("Multiple instance of the same relation detected.")
}).asInstanceOf[this.type]
}
Expand Down

0 comments on commit 87211ce

Please sign in to comment.