GravityLabs / HPaste

HBase DSL for Scala with MapReduce support
http://www.gravity.com/technology/
Apache License 2.0
127 stars 32 forks source link

Formalize a way for modifying state in an in-memory Row result #5

Open Lemmsjid opened 12 years ago

Lemmsjid commented 12 years ago

Sometimes you want to do the following:

HPaste assumes rows returned from Hbase are immutable and there is therefore no way to do this without injecting another step, with is to re-fetch the data from Hbase. This is in most cases a preferred way to do things, because in-memory state increases the chance of subtle bugs creeping into the system.

That said, there are performance critical hotspots where this needs to be supported.

The tentative way to do this is to simply provide a copy constructor for an HRow object, along with direct setters for column and row families. In other words, don't manipulate the state of the original object, instead provide a scenario where you can copy the object and manipuate the state during the copy operation. This will reduce the number of subtle bugs that can arrive from doing things like caching ancillary results in HRow objects.