Skip to content

Commit

Permalink
Split long lines across several
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerk committed Jun 24, 2015
1 parent 73d5d4d commit 8e52975
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/main/scala/workflow/Transformer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ abstract class Transformer[A, B : ClassTag] extends TransformerNode[B] with Pipe
*/
def apply(in: A): B

private[workflow] final def transform(dataDependencies: Seq[_], fitDependencies: Seq[TransformerNode[_]]): B = apply(dataDependencies.head.asInstanceOf[A])
private[workflow] final def transform(
dataDependencies: Seq[_],
fitDependencies: Seq[TransformerNode[_]]): B = {
apply(dataDependencies.head.asInstanceOf[A])
}

private[workflow] final def transformRDD(dataDependencies: Seq[RDD[_]], fitDependencies: Seq[TransformerNode[_]]): RDD[B] = apply(dataDependencies.head.asInstanceOf[RDD[A]])
private[workflow] final def transformRDD(
dataDependencies: Seq[RDD[_]],
fitDependencies: Seq[TransformerNode[_]]): RDD[B] = {
apply(dataDependencies.head.asInstanceOf[RDD[A]])
}
}

object Transformer {
Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/workflow/DelegatingTransformerSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class DelegatingTransformerSuite extends FunSuite with LocalSparkContext with Lo
val delegatingTransformer = new DelegatingTransformer[Int]("label")

val strings = Seq("A31DFSsafds*be31", "lj32fsd", "woadsf8923")
val transformedStrings = delegatingTransformer.transformRDD(Seq(sc.parallelize(strings)), Seq(hashTransformer)).collect()
val transformedStrings = delegatingTransformer.transformRDD(
Seq(sc.parallelize(strings)),
Seq(hashTransformer)).collect()
assert(transformedStrings.toSeq === strings.map(_.hashCode))
}

Expand Down
13 changes: 11 additions & 2 deletions src/test/scala/workflow/PipelineSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,19 @@ class PipelineSuite extends FunSuite with LocalSparkContext with Logging {
}

val single = 7
assert(pipeline(single) === Seq(firstPipeline.apply(single), secondPipeline.apply(single), thirdPipeline.apply(single)))
assert {
pipeline(single) === Seq(
firstPipeline.apply(single),
secondPipeline.apply(single),
thirdPipeline.apply(single))
}

val data = Seq(13, 2, 83)
val correctOut = data.map(x => Seq(firstPipeline.apply(x), secondPipeline.apply(x), thirdPipeline.apply(x)))
val correctOut = data.map { x => Seq(
firstPipeline.apply(x),
secondPipeline.apply(x),
thirdPipeline.apply(x))
}
assert(pipeline(sc.parallelize(data)).collect().toSeq === correctOut)
}
}

0 comments on commit 8e52975

Please sign in to comment.