spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhusted <>
Subject Re: Sorting a Sequence File
Date Fri, 03 Oct 2014 00:02:24 GMT
Here is the code in question

//read in the hadoop sequence file to sort
 val file = sc.sequenceFile(input, classOf[Text], classOf[Text])

//this is the code we would like to avoid that maps the Hadoop Text Input to
Strings so the sortyByKey will run{ case (k,v) => (k.toString(), v.toString())} 

//perform the sort on the converted data
    val sortedOutput = file.sortByKey(true, 1)

//write out the results
    sortedOutput.saveAsSequenceFile(output, Some(classOf[DefaultCodec]))

View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message