Skip to content

Instantly share code, notes, and snippets.

@WilliamBerryiii
Created February 29, 2016 23:15
Show Gist options
  • Save WilliamBerryiii/0b998619142f71efa92f to your computer and use it in GitHub Desktop.
Save WilliamBerryiii/0b998619142f71efa92f to your computer and use it in GitHub Desktop.
Sample HBase Data Writer
let writeData (client:Hbase.Client) tableName dataColumn data =
let writePrams = new Dictionary<byte[],byte[]>()
let mutation = Collection.init [new Mutation ( Column = getBytes dataColumn, Value = getBytes data.Payload ) ] : List<Mutation>
let returnIdKeyedRow = new BatchMutation( Row = getBytes data.CompositeKey, Mutations = mutation )
let deptClassSubKeyedRow = new BatchMutation( Row = getBytes data.ReverseCompositeKey, Mutations = mutation )
let rows : List<BatchMutation> = Collection.init [returnIdKeyedRow; deptClassSubKeyedRow]
let result = client.mutateRows(getBytes tableName, rows, writePrams)
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment