Skip to content

Instantly share code, notes, and snippets.

@ludflu
Last active August 29, 2015 14:26
Show Gist options
  • Save ludflu/5dedb8816d06a87b2208 to your computer and use it in GitHub Desktop.
Save ludflu/5dedb8816d06a87b2208 to your computer and use it in GitHub Desktop.
scalding test
import com.twitter.scalding._
import com.twitter.scalding.ReplImplicits._
import com.twitter.scalding.ReplImplicitContext._
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
case class LatLonRecord(date : DateTime, msidn : String, lat : Double, lon : Double, cellname : String)
implicit def stringToDateTime(dateStr: String) : DateTime =
DateTime.parse(dateStr, DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.S"))
val inputFile = "/Users/jsnavely/project/sample_data/tm_small.csv"
type Input = (DateTime, String, Double, Double, String)
val lines: TypedPipe[Input] = TypedPipe.from( TypedPsv[Input]( inputFile) )
lines.map( x => x._1).dump
//cascading.flow.FlowException: local step failed at java.lang.Thread.run(Thread.java:745)
//Caused by: cascading.pipe.OperatorException: [FixedPathTypedDelimite...][com.twitter.scalding.RichPipe.eachTo(RichPipe.scala:509)] operator Each failed executing operation
//Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.joda.time.DateTime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment