spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhusted <brian.hus...@gmail.com>
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
     file.map{ 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: http://apache-spark-user-list.1001560.n3.nabble.com/Sorting-a-Sequence-File-tp15633p15647.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message