Skip to content

Instantly share code, notes, and snippets.

@sameei
Created January 17, 2016 03:24
Show Gist options
  • Save sameei/d4289d40da37ba67f622 to your computer and use it in GitHub Desktop.
Save sameei/d4289d40da37ba67f622 to your computer and use it in GitHub Desktop.
// in the name of ALLAH
case class PopulationStat(
val country: String,
val symbol: String,
val year: Int,
val amount: Long
)
class WritablePopulationStat extends WritableComparable[WritablePopulationStat] {
def this(v:PopulationStat) = { value = v }
var value: PopulationStat = _
private val text = new Text
def wrtie(out: DataOutput) = {
text set value.symbol
text write out
WritableUtils writeVInt(out, value.year)
WritableUtils writeVLong(out, value.amount)
text set value.country
text write out
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment