Skip to content

Commit

Permalink
Fix stack overflow in typedPipeMonoid.zero
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajroark committed May 22, 2017
1 parent 808ecb2 commit 2ca5089
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ object TypedPipe extends Serializable {
* TypedPipe instances are monoids. They are isomorphic to multisets.
*/
implicit def typedPipeMonoid[T]: Monoid[TypedPipe[T]] = new Monoid[TypedPipe[T]] {
def zero = empty
def zero = TypedPipe.empty
def plus(left: TypedPipe[T], right: TypedPipe[T]): TypedPipe[T] =
left ++ right
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.twitter.scalding

import org.scalatest.{ FunSuite, Matchers, WordSpec }

import com.twitter.algebird.Monoid
import com.twitter.scalding.source.TypedText
// Use the scalacheck generators
import org.scalacheck.Gen
Expand Down Expand Up @@ -121,6 +122,15 @@ class TypedSumByKeyTest extends WordSpec with Matchers {
}
}

class TypedPipeMonoidTest extends WordSpec with Matchers {
"typedPipeMonoid.zero" should {
"be equal to typedPipeMonoid.empty" in {
val mon = implicitly[Monoid[TypedPipe[Int]]]
assert(mon.zero == mon.empty)
}
}
}

class TypedPipeSortByJob(args: Args) extends Job(args) {
TypedPipe.from(TypedText.tsv[(Int, Float, String)]("input"))
.groupBy(_._1)
Expand Down

0 comments on commit 2ca5089

Please sign in to comment.