Skip to content

Latest commit

 

History

History
75 lines (66 loc) · 4.29 KB

combiner.md

File metadata and controls

75 lines (66 loc) · 4.29 KB

Apache Accumulo Combiner Example

This tutorial uses the following Java class, which can be found in org.apache.accumulo.examples.combiner:

This is a simple combiner example. To build this example run maven and then copy the produced jar into the accumulo lib dir. This is already done in the tar distribution.

$ bin/accumulo shell -u username
Enter current password for 'username'@'instance': ***

Shell - Apache Accumulo Interactive Shell
-
- version: 2.1.0-SNAPSHOT
- instance name: instance
- instance id: 00000000-0000-0000-0000-000000000000
-
- type 'help' for a list of available commands
-
username@instance> createnamespace examples
username@instance> createtable examples.runners
username@instance examples.runners> setiter -t examples.runners -p 10 -scan -minc -majc -n decStats -class org.apache.accumulo.examples.combiner.StatsCombiner
Combiner that keeps track of min, max, sum, and count
----------> set StatsCombiner parameter all, set to true to apply Combiner to every column, otherwise leave blank. if true, columns option will be ignored.: 
----------> set StatsCombiner parameter columns, <col fam>[:<col qual>]{,<col fam>[:<col qual>]} escape non aplhanum chars using %<hex>.: stat
----------> set StatsCombiner parameter reduceOnFullCompactionOnly, If true, only reduce on full major compactions.  Defaults to false. : 
----------> set StatsCombiner parameter radix, radix/base of the numbers: 10
username@instance examples.runners> setiter -t examples.runners -p 11 -scan -minc -majc -n hexStats -class org.apache.accumulo.examples.combiner.StatsCombiner
Combiner that keeps track of min, max, sum, and count
----------> set StatsCombiner parameter all, set to true to apply Combiner to every column, otherwise leave blank. if true, columns option will be ignored.: 
----------> set StatsCombiner parameter columns, <col fam>[:<col qual>]{,<col fam>[:<col qual>]} escape non-alphanum chars using %<hex>.: hstat
----------> set StatsCombiner parameter reduceOnFullCompactionOnly, If true, only reduce on full major compactions.  Defaults to false. : 
----------> set StatsCombiner parameter radix, radix/base of the numbers: 16
username@instance examples.runners> insert 123456 name first Joe
username@instance examples.runners> insert 123456 stat marathon 240
username@instance examples.runners> scan
123456 name:first []    Joe
123456 stat:marathon []    240,240,240,1
username@instance examples.runners> insert 123456 stat marathon 230
username@instance examples.runners> insert 123456 stat marathon 220
username@instance examples.runners> scan
123456 name:first []    Joe
123456 stat:marathon []    220,240,690,3
username@instance examples.runners> insert 123456 hstat virtualMarathon 6a
username@instance examples.runners> insert 123456 hstat virtualMarathon 6b
username@instance examples.runners> scan
123456 hstat:virtualMarathon []    6a,6b,d5,2
123456 name:first []    Joe
123456 stat:marathon []    220,240,690,3

In this example a table is created, and the example stats combiner is applied to the column family stat and hstat. The stats combiner computes min,max,sum, and count. It can be configured to use a different base or radix. In the example above the column family stat is configured for base 10 and the column family hstat is configured for base 16.