public class BulkDataGeneratorMapper extends org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,org.apache.hadoop.io.NullWritable,org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.KeyValue>
Modifier and Type | Class and Description |
---|---|
static class |
BulkDataGeneratorMapper.Counters
Counter enumeration to count number of rows generated.
|
Modifier and Type | Field and Description |
---|---|
(package private) static byte[] |
COLUMN_FAMILY_BYTES |
private static List<String> |
LOCATION_KEYS |
private static Map<String,org.apache.commons.math3.util.Pair<BigDecimal,BigDecimal>> |
LOCATIONS |
private static int |
MAX_EVENT_ID |
private static int |
MAX_SPEED_KPH |
private static int |
MAX_VEHICLE_ID |
private static int |
NUM_LOCATIONS |
private static String |
ORG_ID |
private static Random |
random |
static String |
SPLIT_COUNT_KEY |
private static int |
splitCount |
Constructor and Description |
---|
BulkDataGeneratorMapper() |
Modifier and Type | Method and Description |
---|---|
private void |
addKeyValue(org.apache.hadoop.mapreduce.Mapper.Context context,
org.apache.hadoop.hbase.io.ImmutableBytesWritable key,
Utility.TableColumnNames columnName,
String value) |
protected void |
map(org.apache.hadoop.io.Text key,
org.apache.hadoop.io.NullWritable value,
org.apache.hadoop.mapreduce.Mapper.Context context)
Generates a single record based on value set to the key by
BulkDataGeneratorRecordReader.getCurrentKey() . |
protected void |
setup(org.apache.hadoop.mapreduce.Mapper.Context context) |
public static final String SPLIT_COUNT_KEY
private static final String ORG_ID
private static final int MAX_EVENT_ID
private static final int MAX_VEHICLE_ID
private static final int MAX_SPEED_KPH
private static final int NUM_LOCATIONS
private static int splitCount
private static final Map<String,org.apache.commons.math3.util.Pair<BigDecimal,BigDecimal>> LOCATIONS
private static final List<String> LOCATION_KEYS
static final byte[] COLUMN_FAMILY_BYTES
public BulkDataGeneratorMapper()
protected void setup(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
setup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,org.apache.hadoop.io.NullWritable,org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.KeyValue>
IOException
InterruptedException
protected void map(org.apache.hadoop.io.Text key, org.apache.hadoop.io.NullWritable value, org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
BulkDataGeneratorRecordReader.getCurrentKey()
.
Utility.TableColumnNames.TOOL_EVENT_ID
is first part of row key. Keeping first
Utility.SPLIT_PREFIX_LENGTH
characters as index of the record to be generated ensures
that records are equally distributed across all regions of the table since region boundaries
are generated in similar fashion. Check Utility.createTable(Admin, String, int, Map)
method for region split info.map
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,org.apache.hadoop.io.NullWritable,org.apache.hadoop.hbase.io.ImmutableBytesWritable,org.apache.hadoop.hbase.KeyValue>
key
- - The key having index of next record to be generatedvalue
- - Value associated with the key (not used)context
- - Context of the mapper containerIOException
InterruptedException
private void addKeyValue(org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.io.ImmutableBytesWritable key, Utility.TableColumnNames columnName, String value) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.