Created
August 21, 2013 18:52
-
-
Save emaxerrno/6298625 to your computer and use it in GitHub Desktop.
deletedtt.java
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
| def tupleListForPageView(pvld: PageViewLogData): TupleList = { | |
| import com.yieldmo.hadoop.scalding.DiscreteVariableStates._ | |
| val isCell = (Option(pvld.getCellular()) getOrElse false).asInstanceOf[Boolean] | |
| val location = Option(pvld.getLocation()) getOrElse { new Location } | |
| var metro = "other" | |
| var country = "other" | |
| Option(location).foreach { loc: Location => | |
| if (loc.getMetroCode != 0) metro = "" + loc.getMetroCode | |
| Option(loc.getCountryCode) foreach { x: String => country = getCountry(x) } | |
| } | |
| def tupleListForResult(list: Iterable[ResultImpression]): TupleList = list match { | |
| case head :: tail => | |
| def creativeListToLabelList(creativeList: Iterable[ResultCreative]): TupleList = creativeList match{ | |
| case creativeHead::creativeTail => | |
| def randomVariableAssignment(l:String, assign: String):(Long,Long,String,String) = | |
| (head.getPlacementId().toLong,creativeHead.getAdvertiserId.getValue,l,assign) | |
| List(randomVariableAssignment("metro", metro), | |
| randomVariableAssignment("country", country)) ++ | |
| creativeListToLabelList(creativeTail) | |
| case Nil => List() | |
| } | |
| creativeListToLabelList(scala.collection.JavaConversions.asScalaIterable(head.getCreatives())) | |
| case Nil => List() | |
| } | |
| tupleListForResult(scala.collection.JavaConversions.asScalaIterable(pvld.getResults())) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is the same as