Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created August 20, 2013 17:11
Show Gist options
  • Select an option

  • Save emaxerrno/6284317 to your computer and use it in GitHub Desktop.

Select an option

Save emaxerrno/6284317 to your computer and use it in GitHub Desktop.
Clean naivemo start
package com.yieldmo.hadoop.scalding
import com.yieldmo.common.admodels.EventSequence
import com.yieldmo.common.admodels.adserver.PageViewLogData
import com.yieldmo.common.protobuf.Events
object NaiveUtils {
type TupleList = List[(Long,Long,String,String)]
def eventSeqToTupleList(seq: EventSequence): TupleList = {
(seq.getPageView() match {
case Some(pvld) => tupleListForPageView(pvld)
case None => List()
}) ++
tupleListForClicks(seq.getActions) ++
tupleListForActionSeeds(getListOfActionSeeds(seq.getActionSeeds))
}
def getListOfActionSeeds(seeds: Iterable[Events.ActionSeed]): List[Events.ActionSeed] = {
List()
}
def tupleListForActionSeeds(seeds: Iterable[Events.ActionSeed]) = {
List()
}
def tupleListForPageView(pvld: PageViewLogData): TupleList = {
List()
}
def tupleListForClicks(actions: Iterable[Events.Action]): TupleList = {
actions map { a: Events.Action =>
val info = a.getImpInfo
(info.getPlacementId, info.getAdvertiserId, "click", "click")
} toList
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment