Class MultiTableInputFormat

java.lang.Object
org.apache.hadoop.mapreduce.InputFormat<ImmutableBytesWritable,Result>
org.apache.hadoop.hbase.mapreduce.MultiTableInputFormatBase
org.apache.hadoop.hbase.mapreduce.MultiTableInputFormat
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable

@Public public class MultiTableInputFormat extends MultiTableInputFormatBase implements org.apache.hadoop.conf.Configurable
Convert HBase tabular data from multiple scanners into a format that is consumable by Map/Reduce.

Usage example

 List<Scan> scans = new ArrayList<Scan>();

 Scan scan1 = new Scan();
 scan1.withStartRow(firstRow1);
 scan1.withStopRow(lastRow1);
 scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table1);
 scans.add(scan1);

 Scan scan2 = new Scan();
 scan2.withStartRow(firstRow2);
 scan2.withStopRow(lastRow2);
 scan1.setAttribute(Scan.SCAN_ATTRIBUTES_TABLE_NAME, table2);
 scans.add(scan2);

 TableMapReduceUtil.initTableMapperJob(scans, TableMapper.class, Text.class, IntWritable.class,
   job);
 
  • Field Details

    • SCANS

      public static final String SCANS
      Job parameter that specifies the scan list.
      See Also:
    • conf

      private org.apache.hadoop.conf.Configuration conf
      The configuration.
  • Constructor Details

  • Method Details

    • getConf

      public org.apache.hadoop.conf.Configuration getConf()
      Returns the current configuration.
      Specified by:
      getConf in interface org.apache.hadoop.conf.Configurable
      Returns:
      The current configuration.
      See Also:
      • Configurable.getConf()
    • setConf

      public void setConf(org.apache.hadoop.conf.Configuration configuration)
      Sets the configuration. This is used to set the details for the tables to be scanned.
      Specified by:
      setConf in interface org.apache.hadoop.conf.Configurable
      Parameters:
      configuration - The configuration to set.
      See Also:
      • Configurable.setConf(org.apache.hadoop.conf.Configuration)