Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

package com.twitter.summingbird.batch

import com.twitter.algebird.Monoid
import com.twitter.algebird.{ Monoid, Predecessible, Successible }
import com.twitter.bijection.Bijection
import java.util.Date
import com.twitter.scalding.RichDate
Expand Down Expand Up @@ -53,4 +53,13 @@ object Timestamp {
implicit val timestamp2Long: Bijection[Timestamp, Long] =
Bijection.build[Timestamp, Long] { _.milliSinceEpoch } { 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
}

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
}
}