Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into release/0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Ritchie committed Sep 12, 2013
2 parents 5015970 + ccdda54 commit b83b186
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ object SummingbirdBuild extends Build {
"com.backtype" % "dfs-datastores" % dfsDatastoresVersion,
"com.backtype" % "dfs-datastores-cascading" % dfsDatastoresVersion,
"com.twitter" %% "algebird-core" % algebirdVersion,
"com.twitter" %% "algebird-bijection" % algebirdVersion,
withCross("com.twitter" %% "bijection-json" % bijectionVersion),
withCross("com.twitter" %% "bijection-algebird" % bijectionVersion),
withCross("com.twitter" %% "chill" % chillVersion),
"com.twitter" %% "scalding-core" % scaldingVersion,
withCross("com.twitter" %% "scalding-commons" % "0.2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

package com.twitter.summingbird.scalding

import com.twitter.algebird.bijection.BijectedSemigroup
import com.twitter.bijection.ImplicitBijection
import com.twitter.bijection.algebird.BijectedSemigroup
import com.twitter.algebird.{Monoid, Semigroup}
import com.twitter.algebird.{ Universe, Empty, Interval, Intersection, InclusiveLower, ExclusiveUpper, InclusiveUpper }
import com.twitter.algebird.monad.{StateWithError, Reader}
Expand Down Expand Up @@ -134,9 +135,17 @@ trait BatchedScaldingStore[K, V] extends ScaldingStore[K, V] { self =>
*/
def unpackBijectedSemigroup[U]: Option[(Bijection[V, U], Semigroup[U])] =
sg match {
case innerSg: BijectedSemigroup[U, V] => Some(
innerSg.bijection -> innerSg.sg
)
case innerSg: BijectedSemigroup[_, _] =>
def getField[F: ClassManifest](fieldName: String): F = {
val f = classOf[BijectedSemigroup[_, _]].getDeclaredField(fieldName)
f.setAccessible(true)
implicitly[ClassManifest[F]]
.erasure.asInstanceOf[Class[F]].cast(f.get(innerSg))
}
Some((
getField[ImplicitBijection[U, V]]("bij").bijection.inverse,
getField[Semigroup[U]]("sg")
))
case _ => None
}

Expand Down

0 comments on commit b83b186

Please sign in to comment.