Created
August 20, 2013 17:11
-
-
Save emaxerrno/6284317 to your computer and use it in GitHub Desktop.
Clean naivemo start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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