org.apache.crunch.examples
Class WordAggregationHBase
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.crunch.examples.WordAggregationHBase
- All Implemented Interfaces:
- Serializable, org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool
public class WordAggregationHBase
- extends org.apache.hadoop.conf.Configured
- implements org.apache.hadoop.util.Tool, Serializable
You need to have a HBase instance running. Required dependencies : hbase /!\
The version should be your version of hbase.
org.apache.hbase hbase
...
- See Also:
- Serialized Form
Methods inherited from class org.apache.hadoop.conf.Configured |
getConf, setConf |
Methods inherited from interface org.apache.hadoop.conf.Configurable |
getConf, setConf |
WordAggregationHBase
public WordAggregationHBase()
run
public int run(String[] args)
throws Exception
- Specified by:
run
in interface org.apache.hadoop.util.Tool
- Throws:
Exception
extractText
public PTable<String,String> extractText(PTable<org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.client.Result> words)
- Extract information from hbase
- Parameters:
words
- the source from hbase
- Returns:
- a
PTable
composed of the type of the input as key
and its def as value
createPut
public PCollection<org.apache.hadoop.hbase.client.Put> createPut(PTable<String,String> extractedText)
- Create puts in order to insert them in hbase.
- Parameters:
extractedText
- a PTable which contain the data in order to create the puts:
keys of the PTable are rowkeys for the puts, values are the
values for hbase.
- Returns:
- a PCollection formed by the puts.
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.