From c77c60005b8d61cfade532f370359f1282a79531 Mon Sep 17 00:00:00 2001 From: devin-petersohn Date: Fri, 5 May 2017 11:51:43 -0700 Subject: [PATCH] Making TreeRegionJoin consistent with ShuffleRegionJoin --- .../org/bdgenomics/adam/rdd/TreeRegionJoin.scala | 13 +++++-------- .../bdgenomics/adam/rdd/TreeRegionJoinSuite.scala | 5 +---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/adam-core/src/main/scala/org/bdgenomics/adam/rdd/TreeRegionJoin.scala b/adam-core/src/main/scala/org/bdgenomics/adam/rdd/TreeRegionJoin.scala index 46cea8345b..22642a5afa 100644 --- a/adam-core/src/main/scala/org/bdgenomics/adam/rdd/TreeRegionJoin.scala +++ b/adam-core/src/main/scala/org/bdgenomics/adam/rdd/TreeRegionJoin.scala @@ -29,7 +29,7 @@ import scala.reflect.ClassTag * The broadcast values are stored in a sorted array. It was going to be an * ensemble of interval trees, but, that didn't work out. */ -trait TreeRegionJoin[T, U] { +trait TreeRegionJoin[T, U, RT, RU] extends RegionJoin[T, U, RT, RU] { private[rdd] def runJoinAndGroupByRightWithTree( tree: IntervalArray[ReferenceRegion, T], @@ -84,7 +84,7 @@ trait TreeRegionJoin[T, U] { /** * Implements an inner region join where the left side of the join is broadcast. */ -case class InnerTreeRegionJoin[T: ClassTag, U: ClassTag]() extends RegionJoin[T, U, T, U] with TreeRegionJoin[T, U] { +case class InnerTreeRegionJoin[T: ClassTag, U: ClassTag]() extends TreeRegionJoin[T, U, T, U] { def broadcastAndJoin(tree: IntervalArray[ReferenceRegion, T], joinedRDD: RDD[(ReferenceRegion, U)]): RDD[(T, U)] = { @@ -119,8 +119,7 @@ case class InnerTreeRegionJoin[T: ClassTag, U: ClassTag]() extends RegionJoin[T, * broadcast. */ case class RightOuterTreeRegionJoin[T: ClassTag, U: ClassTag]() - extends RegionJoin[T, U, Option[T], U] - with TreeRegionJoin[T, U] { + extends TreeRegionJoin[T, U, Option[T], U] { def broadcastAndJoin(tree: IntervalArray[ReferenceRegion, T], joinedRDD: RDD[(ReferenceRegion, U)]): RDD[(Option[T], U)] = { @@ -168,8 +167,7 @@ case class RightOuterTreeRegionJoin[T: ClassTag, U: ClassTag]() * values on the left grouped by the right value. */ case class InnerTreeRegionJoinAndGroupByRight[T: ClassTag, U: ClassTag]() - extends RegionJoin[T, U, Iterable[T], U] - with TreeRegionJoin[T, U] { + extends TreeRegionJoin[T, U, Iterable[T], U] { def broadcastAndJoin(tree: IntervalArray[ReferenceRegion, T], joinedRDD: RDD[(ReferenceRegion, U)]): RDD[(Iterable[T], U)] = { @@ -203,8 +201,7 @@ case class InnerTreeRegionJoinAndGroupByRight[T: ClassTag, U: ClassTag]() * collections on the left side of the join are kept. */ case class RightOuterTreeRegionJoinAndGroupByRight[T: ClassTag, U: ClassTag]() - extends RegionJoin[T, U, Iterable[T], U] - with TreeRegionJoin[T, U] { + extends TreeRegionJoin[T, U, Iterable[T], U] { def broadcastAndJoin(tree: IntervalArray[ReferenceRegion, T], joinedRDD: RDD[(ReferenceRegion, U)]): RDD[(Iterable[T], U)] = { diff --git a/adam-core/src/test/scala/org/bdgenomics/adam/rdd/TreeRegionJoinSuite.scala b/adam-core/src/test/scala/org/bdgenomics/adam/rdd/TreeRegionJoinSuite.scala index 51701bad8b..4cfdaf4bbf 100644 --- a/adam-core/src/test/scala/org/bdgenomics/adam/rdd/TreeRegionJoinSuite.scala +++ b/adam-core/src/test/scala/org/bdgenomics/adam/rdd/TreeRegionJoinSuite.scala @@ -24,9 +24,6 @@ import org.bdgenomics.formats.avro.{ AlignmentRecord, Variant } import org.bdgenomics.utils.interval.array.IntervalArray import scala.reflect.ClassTag -private case class ConcreteTreeRegionJoin[T: ClassTag, U]() extends TreeRegionJoin[T, U] { -} - class TreeRegionJoinSuite extends ADAMFunSuite { sparkTest("run a join between data on a single contig") { @@ -62,7 +59,7 @@ class TreeRegionJoinSuite extends ADAMFunSuite { .build) }) - val joinData = ConcreteTreeRegionJoin().runJoinAndGroupByRightWithTree(tree, + val joinData = InnerTreeRegionJoin().runJoinAndGroupByRightWithTree(tree, leftRdd) .map(kv => { val (k, v) = kv