Skip to content

Commit

Permalink
Scala Hadoop Enrich: simplified validation projection code (closes #1986
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fblundun authored and alexanderdean committed Jan 14, 2016
1 parent 922abb5 commit db9a8c0
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ object EtlJob {
* Strings
*/
def projectBads(all: List[ValidatedEnrichedEvent]): List[NonEmptyList[String]] = all
.map(_.swap.toOption)
.collect { case Some(errs) =>
errs
.collect {
case Failure(errs) => errs
}

/**
Expand All @@ -120,9 +119,8 @@ object EtlJob {
* @return a (possibly empty) List of EnrichedEvents
*/
def projectGoods(all: List[ValidatedEnrichedEvent]): List[EnrichedEvent] = all
.map(_.toOption)
.collect { case Some(gd) =>
gd
.collect {
case Success(gd) => gd
}
}

Expand Down

0 comments on commit db9a8c0

Please sign in to comment.