Skip to content

Commit

Permalink
Fix algebird related issues based on twitter#715
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Abishev committed May 27, 2017
1 parent 6e71684 commit 78528bf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class HDFSStateLaws extends WordSpec {
}
}

def leftClosedRightOpenInterval(low: Timestamp, high: Timestamp) = Interval.leftClosedRightOpen[Timestamp](low, high).right.get
def leftClosedRightOpenInterval(low: Timestamp, high: Timestamp): Interval[Timestamp] =
Interval.leftClosedRightOpen[Timestamp](low, high)

def shouldNotAcceptInterval(state: WaitingState[Interval[Timestamp]], interval: Interval[Timestamp], message: String = "PreparedState accepted a bad Interval!") = {
state.begin.willAccept(interval) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ object BatchID {
.flatMap {
case (min, max, cnt) =>
if ((min + cnt) == (max + 1L)) {
Some(Interval.leftClosedRightOpen(min, max.next).right.get)
Some[Interval[BatchID]](Interval.leftClosedRightOpen(min, max.next))
} else {
// These batches are not contiguous, not an interval
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ object Timestamp {
implicit val timestampSuccessible: Successible[Timestamp] = new Successible[Timestamp] {
def next(old: Timestamp) = if (old.milliSinceEpoch != Long.MaxValue) Some(old.next) else None
def ordering: Ordering[Timestamp] = Timestamp.orderingOnTimestamp
def partialOrdering = Timestamp.orderingOnTimestamp
}

implicit val timestampPredecessible: Predecessible[Timestamp] = new Predecessible[Timestamp] {
def prev(old: Timestamp) = if (old.milliSinceEpoch != Long.MinValue) Some(old.prev) else None
def ordering: Ordering[Timestamp] = Timestamp.orderingOnTimestamp
def partialOrdering = Timestamp.orderingOnTimestamp
}

// This is a right semigroup, that given any two Timestamps just take the one on the right.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ object BatchLaws extends Properties("BatchID") {
forAll(Arbitrary.arbitrary[BatchID], Gen.choose(0L, 1000L)) { (b1: BatchID, diff: Long) =>
// We can't enumerate too much:
val b2 = b1 + diff
val interval = Interval.leftClosedRightOpen(b1, b2.next) match {
case Left(i) => i
case Right(i) => i
}
val interval: Interval[BatchID] = Interval.leftClosedRightOpen(b1, b2.next)
(BatchID.toInterval(BatchID.range(b1, b2)) == Some(interval)) &&
BatchID.toIterable(interval).toList == BatchID.range(b1, b2).toList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private[scalding] class VersionedState(meta: HDFSMetadata, startDate: Option[Tim
Interval.leftClosedRightOpen(
batcher.earliestTimeOf(beginning),
batcher.earliestTimeOf(end)
).right.get
)
}

def willAccept(available: Interval[Timestamp]) =
Expand Down

0 comments on commit 78528bf

Please sign in to comment.