hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [28/52] [partial] hbase-site git commit: Published site at 75c23605430266da0f30eef04b97ebd4b30c60b8.
Date Tue, 31 May 2016 17:50:59 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/db523e4d/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.html b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.html
index cac98c7..74c422b 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.html
@@ -452,7 +452,7 @@
 <span class="sourceLineNo">444</span>  private void validateFamiliesInHFiles(Table table, Deque&lt;LoadQueueItem&gt; queue)<a name="line.444"></a>
 <span class="sourceLineNo">445</span>      throws IOException {<a name="line.445"></a>
 <span class="sourceLineNo">446</span>    Collection&lt;HColumnDescriptor&gt; families = table.getTableDescriptor().getFamilies();<a name="line.446"></a>
-<span class="sourceLineNo">447</span>    List&lt;String&gt; familyNames = new ArrayList&lt;String&gt;(families.size());<a name="line.447"></a>
+<span class="sourceLineNo">447</span>    List&lt;String&gt; familyNames = new ArrayList&lt;&gt;(families.size());<a name="line.447"></a>
 <span class="sourceLineNo">448</span>    for (HColumnDescriptor family : families) {<a name="line.448"></a>
 <span class="sourceLineNo">449</span>      familyNames.add(family.getNameAsString());<a name="line.449"></a>
 <span class="sourceLineNo">450</span>    }<a name="line.450"></a>
@@ -509,7 +509,7 @@
 <span class="sourceLineNo">501</span>      ExecutorService pool, Deque&lt;LoadQueueItem&gt; queue,<a name="line.501"></a>
 <span class="sourceLineNo">502</span>      final Multimap&lt;ByteBuffer, LoadQueueItem&gt; regionGroups) throws IOException {<a name="line.502"></a>
 <span class="sourceLineNo">503</span>    // atomically bulk load the groups.<a name="line.503"></a>
-<span class="sourceLineNo">504</span>    Set&lt;Future&lt;List&lt;LoadQueueItem&gt;&gt;&gt; loadingFutures = new HashSet&lt;Future&lt;List&lt;LoadQueueItem&gt;&gt;&gt;();<a name="line.504"></a>
+<span class="sourceLineNo">504</span>    Set&lt;Future&lt;List&lt;LoadQueueItem&gt;&gt;&gt; loadingFutures = new HashSet&lt;&gt;();<a name="line.504"></a>
 <span class="sourceLineNo">505</span>    for (Entry&lt;ByteBuffer, ? extends Collection&lt;LoadQueueItem&gt;&gt; e: regionGroups.asMap().entrySet()){<a name="line.505"></a>
 <span class="sourceLineNo">506</span>      final byte[] first = e.getKey().array();<a name="line.506"></a>
 <span class="sourceLineNo">507</span>      final Collection&lt;LoadQueueItem&gt; lqis =  e.getValue();<a name="line.507"></a>

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/db523e4d/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
index 18172d6..1f612d6 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/TableInputFormat.html
@@ -29,278 +29,279 @@
 <span class="sourceLineNo">021</span>import java.io.IOException;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.util.Collections;<a name="line.22"></a>
 <span class="sourceLineNo">023</span>import java.util.List;<a name="line.23"></a>
-<span class="sourceLineNo">024</span><a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.commons.logging.Log;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.commons.logging.LogFactory;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.conf.Configurable;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.conf.Configuration;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.KeyValue;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.TableName;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.classification.InterfaceStability;<a name="line.32"></a>
-<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.client.Connection;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.client.ConnectionFactory;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.client.RegionLocator;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.client.Scan;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.mapreduce.InputSplit;<a name="line.38"></a>
-<span class="sourceLineNo">039</span>import org.apache.hadoop.mapreduce.JobContext;<a name="line.39"></a>
-<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.util.Pair;<a name="line.40"></a>
-<span class="sourceLineNo">041</span>import org.apache.hadoop.mapreduce.Job;<a name="line.41"></a>
-<span class="sourceLineNo">042</span>import org.apache.hadoop.util.StringUtils;<a name="line.42"></a>
-<span class="sourceLineNo">043</span><a name="line.43"></a>
-<span class="sourceLineNo">044</span>/**<a name="line.44"></a>
-<span class="sourceLineNo">045</span> * Convert HBase tabular data into a format that is consumable by Map/Reduce.<a name="line.45"></a>
-<span class="sourceLineNo">046</span> */<a name="line.46"></a>
-<span class="sourceLineNo">047</span>@InterfaceAudience.Public<a name="line.47"></a>
-<span class="sourceLineNo">048</span>@InterfaceStability.Stable<a name="line.48"></a>
-<span class="sourceLineNo">049</span>public class TableInputFormat extends TableInputFormatBase<a name="line.49"></a>
-<span class="sourceLineNo">050</span>implements Configurable {<a name="line.50"></a>
-<span class="sourceLineNo">051</span><a name="line.51"></a>
-<span class="sourceLineNo">052</span>  @SuppressWarnings("hiding")<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  private static final Log LOG = LogFactory.getLog(TableInputFormat.class);<a name="line.53"></a>
-<span class="sourceLineNo">054</span><a name="line.54"></a>
-<span class="sourceLineNo">055</span>  /** Job parameter that specifies the input table. */<a name="line.55"></a>
-<span class="sourceLineNo">056</span>  public static final String INPUT_TABLE = "hbase.mapreduce.inputtable";<a name="line.56"></a>
-<span class="sourceLineNo">057</span>  /**<a name="line.57"></a>
-<span class="sourceLineNo">058</span>   * If specified, use start keys of this table to split.<a name="line.58"></a>
-<span class="sourceLineNo">059</span>   * This is useful when you are preparing data for bulkload.<a name="line.59"></a>
-<span class="sourceLineNo">060</span>   */<a name="line.60"></a>
-<span class="sourceLineNo">061</span>  private static final String SPLIT_TABLE = "hbase.mapreduce.splittable";<a name="line.61"></a>
-<span class="sourceLineNo">062</span>  /** Base-64 encoded scanner. All other SCAN_ confs are ignored if this is specified.<a name="line.62"></a>
-<span class="sourceLineNo">063</span>   * See {@link TableMapReduceUtil#convertScanToString(Scan)} for more details.<a name="line.63"></a>
-<span class="sourceLineNo">064</span>   */<a name="line.64"></a>
-<span class="sourceLineNo">065</span>  public static final String SCAN = "hbase.mapreduce.scan";<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  /** Scan start row */<a name="line.66"></a>
-<span class="sourceLineNo">067</span>  public static final String SCAN_ROW_START = "hbase.mapreduce.scan.row.start";<a name="line.67"></a>
-<span class="sourceLineNo">068</span>  /** Scan stop row */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>  public static final String SCAN_ROW_STOP = "hbase.mapreduce.scan.row.stop";<a name="line.69"></a>
-<span class="sourceLineNo">070</span>  /** Column Family to Scan */<a name="line.70"></a>
-<span class="sourceLineNo">071</span>  public static final String SCAN_COLUMN_FAMILY = "hbase.mapreduce.scan.column.family";<a name="line.71"></a>
-<span class="sourceLineNo">072</span>  /** Space delimited list of columns and column families to scan. */<a name="line.72"></a>
-<span class="sourceLineNo">073</span>  public static final String SCAN_COLUMNS = "hbase.mapreduce.scan.columns";<a name="line.73"></a>
-<span class="sourceLineNo">074</span>  /** The timestamp used to filter columns with a specific timestamp. */<a name="line.74"></a>
-<span class="sourceLineNo">075</span>  public static final String SCAN_TIMESTAMP = "hbase.mapreduce.scan.timestamp";<a name="line.75"></a>
-<span class="sourceLineNo">076</span>  /** The starting timestamp used to filter columns with a specific range of versions. */<a name="line.76"></a>
-<span class="sourceLineNo">077</span>  public static final String SCAN_TIMERANGE_START = "hbase.mapreduce.scan.timerange.start";<a name="line.77"></a>
-<span class="sourceLineNo">078</span>  /** The ending timestamp used to filter columns with a specific range of versions. */<a name="line.78"></a>
-<span class="sourceLineNo">079</span>  public static final String SCAN_TIMERANGE_END = "hbase.mapreduce.scan.timerange.end";<a name="line.79"></a>
-<span class="sourceLineNo">080</span>  /** The maximum number of version to return. */<a name="line.80"></a>
-<span class="sourceLineNo">081</span>  public static final String SCAN_MAXVERSIONS = "hbase.mapreduce.scan.maxversions";<a name="line.81"></a>
-<span class="sourceLineNo">082</span>  /** Set to false to disable server-side caching of blocks for this scan. */<a name="line.82"></a>
-<span class="sourceLineNo">083</span>  public static final String SCAN_CACHEBLOCKS = "hbase.mapreduce.scan.cacheblocks";<a name="line.83"></a>
-<span class="sourceLineNo">084</span>  /** The number of rows for caching that will be passed to scanners. */<a name="line.84"></a>
-<span class="sourceLineNo">085</span>  public static final String SCAN_CACHEDROWS = "hbase.mapreduce.scan.cachedrows";<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  /** Set the maximum number of values to return for each call to next(). */<a name="line.86"></a>
-<span class="sourceLineNo">087</span>  public static final String SCAN_BATCHSIZE = "hbase.mapreduce.scan.batchsize";<a name="line.87"></a>
-<span class="sourceLineNo">088</span>  /** Specify if we have to shuffle the map tasks. */<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  public static final String SHUFFLE_MAPS = "hbase.mapreduce.inputtable.shufflemaps";<a name="line.89"></a>
-<span class="sourceLineNo">090</span><a name="line.90"></a>
-<span class="sourceLineNo">091</span>  /** The configuration. */<a name="line.91"></a>
-<span class="sourceLineNo">092</span>  private Configuration conf = null;<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>  /**<a name="line.94"></a>
-<span class="sourceLineNo">095</span>   * Returns the current configuration.<a name="line.95"></a>
-<span class="sourceLineNo">096</span>   *<a name="line.96"></a>
-<span class="sourceLineNo">097</span>   * @return The current configuration.<a name="line.97"></a>
-<span class="sourceLineNo">098</span>   * @see org.apache.hadoop.conf.Configurable#getConf()<a name="line.98"></a>
-<span class="sourceLineNo">099</span>   */<a name="line.99"></a>
-<span class="sourceLineNo">100</span>  @Override<a name="line.100"></a>
-<span class="sourceLineNo">101</span>  public Configuration getConf() {<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    return conf;<a name="line.102"></a>
-<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
-<span class="sourceLineNo">104</span><a name="line.104"></a>
-<span class="sourceLineNo">105</span>  /**<a name="line.105"></a>
-<span class="sourceLineNo">106</span>   * Sets the configuration. This is used to set the details for the table to<a name="line.106"></a>
-<span class="sourceLineNo">107</span>   * be scanned.<a name="line.107"></a>
-<span class="sourceLineNo">108</span>   *<a name="line.108"></a>
-<span class="sourceLineNo">109</span>   * @param configuration  The configuration to set.<a name="line.109"></a>
-<span class="sourceLineNo">110</span>   * @see org.apache.hadoop.conf.Configurable#setConf(<a name="line.110"></a>
-<span class="sourceLineNo">111</span>   *   org.apache.hadoop.conf.Configuration)<a name="line.111"></a>
-<span class="sourceLineNo">112</span>   */<a name="line.112"></a>
-<span class="sourceLineNo">113</span>  @Override<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="REC_CATCH_EXCEPTION",<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    justification="Intentional")<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  public void setConf(Configuration configuration) {<a name="line.116"></a>
-<span class="sourceLineNo">117</span>    this.conf = configuration;<a name="line.117"></a>
-<span class="sourceLineNo">118</span><a name="line.118"></a>
-<span class="sourceLineNo">119</span>    Scan scan = null;<a name="line.119"></a>
-<span class="sourceLineNo">120</span><a name="line.120"></a>
-<span class="sourceLineNo">121</span>    if (conf.get(SCAN) != null) {<a name="line.121"></a>
-<span class="sourceLineNo">122</span>      try {<a name="line.122"></a>
-<span class="sourceLineNo">123</span>        scan = TableMapReduceUtil.convertStringToScan(conf.get(SCAN));<a name="line.123"></a>
-<span class="sourceLineNo">124</span>      } catch (IOException e) {<a name="line.124"></a>
-<span class="sourceLineNo">125</span>        LOG.error("An error occurred.", e);<a name="line.125"></a>
-<span class="sourceLineNo">126</span>      }<a name="line.126"></a>
-<span class="sourceLineNo">127</span>    } else {<a name="line.127"></a>
-<span class="sourceLineNo">128</span>      try {<a name="line.128"></a>
-<span class="sourceLineNo">129</span>        scan = createScanFromConfiguration(conf);<a name="line.129"></a>
-<span class="sourceLineNo">130</span>      } catch (Exception e) {<a name="line.130"></a>
-<span class="sourceLineNo">131</span>          LOG.error(StringUtils.stringifyException(e));<a name="line.131"></a>
-<span class="sourceLineNo">132</span>      }<a name="line.132"></a>
-<span class="sourceLineNo">133</span>    }<a name="line.133"></a>
-<span class="sourceLineNo">134</span><a name="line.134"></a>
-<span class="sourceLineNo">135</span>    setScan(scan);<a name="line.135"></a>
-<span class="sourceLineNo">136</span>  }<a name="line.136"></a>
-<span class="sourceLineNo">137</span><a name="line.137"></a>
-<span class="sourceLineNo">138</span>  /**<a name="line.138"></a>
-<span class="sourceLineNo">139</span>   * Sets up a {@link Scan} instance, applying settings from the configuration property<a name="line.139"></a>
-<span class="sourceLineNo">140</span>   * constants defined in {@code TableInputFormat}.  This allows specifying things such as:<a name="line.140"></a>
-<span class="sourceLineNo">141</span>   * &lt;ul&gt;<a name="line.141"></a>
-<span class="sourceLineNo">142</span>   *   &lt;li&gt;start and stop rows&lt;/li&gt;<a name="line.142"></a>
-<span class="sourceLineNo">143</span>   *   &lt;li&gt;column qualifiers or families&lt;/li&gt;<a name="line.143"></a>
-<span class="sourceLineNo">144</span>   *   &lt;li&gt;timestamps or timerange&lt;/li&gt;<a name="line.144"></a>
-<span class="sourceLineNo">145</span>   *   &lt;li&gt;scanner caching and batch size&lt;/li&gt;<a name="line.145"></a>
-<span class="sourceLineNo">146</span>   * &lt;/ul&gt;<a name="line.146"></a>
-<span class="sourceLineNo">147</span>   */<a name="line.147"></a>
-<span class="sourceLineNo">148</span>  public static Scan createScanFromConfiguration(Configuration conf) throws IOException {<a name="line.148"></a>
-<span class="sourceLineNo">149</span>    Scan scan = new Scan();<a name="line.149"></a>
-<span class="sourceLineNo">150</span><a name="line.150"></a>
-<span class="sourceLineNo">151</span>    if (conf.get(SCAN_ROW_START) != null) {<a name="line.151"></a>
-<span class="sourceLineNo">152</span>      scan.setStartRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_START)));<a name="line.152"></a>
-<span class="sourceLineNo">153</span>    }<a name="line.153"></a>
-<span class="sourceLineNo">154</span><a name="line.154"></a>
-<span class="sourceLineNo">155</span>    if (conf.get(SCAN_ROW_STOP) != null) {<a name="line.155"></a>
-<span class="sourceLineNo">156</span>      scan.setStopRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_STOP)));<a name="line.156"></a>
-<span class="sourceLineNo">157</span>    }<a name="line.157"></a>
-<span class="sourceLineNo">158</span><a name="line.158"></a>
-<span class="sourceLineNo">159</span>    if (conf.get(SCAN_COLUMNS) != null) {<a name="line.159"></a>
-<span class="sourceLineNo">160</span>      addColumns(scan, conf.get(SCAN_COLUMNS));<a name="line.160"></a>
-<span class="sourceLineNo">161</span>    }<a name="line.161"></a>
-<span class="sourceLineNo">162</span><a name="line.162"></a>
-<span class="sourceLineNo">163</span>    if (conf.get(SCAN_COLUMN_FAMILY) != null) {<a name="line.163"></a>
-<span class="sourceLineNo">164</span>      scan.addFamily(Bytes.toBytes(conf.get(SCAN_COLUMN_FAMILY)));<a name="line.164"></a>
-<span class="sourceLineNo">165</span>    }<a name="line.165"></a>
-<span class="sourceLineNo">166</span><a name="line.166"></a>
-<span class="sourceLineNo">167</span>    if (conf.get(SCAN_TIMESTAMP) != null) {<a name="line.167"></a>
-<span class="sourceLineNo">168</span>      scan.setTimeStamp(Long.parseLong(conf.get(SCAN_TIMESTAMP)));<a name="line.168"></a>
-<span class="sourceLineNo">169</span>    }<a name="line.169"></a>
-<span class="sourceLineNo">170</span><a name="line.170"></a>
-<span class="sourceLineNo">171</span>    if (conf.get(SCAN_TIMERANGE_START) != null &amp;&amp; conf.get(SCAN_TIMERANGE_END) != null) {<a name="line.171"></a>
-<span class="sourceLineNo">172</span>      scan.setTimeRange(<a name="line.172"></a>
-<span class="sourceLineNo">173</span>          Long.parseLong(conf.get(SCAN_TIMERANGE_START)),<a name="line.173"></a>
-<span class="sourceLineNo">174</span>          Long.parseLong(conf.get(SCAN_TIMERANGE_END)));<a name="line.174"></a>
-<span class="sourceLineNo">175</span>    }<a name="line.175"></a>
-<span class="sourceLineNo">176</span><a name="line.176"></a>
-<span class="sourceLineNo">177</span>    if (conf.get(SCAN_MAXVERSIONS) != null) {<a name="line.177"></a>
-<span class="sourceLineNo">178</span>      scan.setMaxVersions(Integer.parseInt(conf.get(SCAN_MAXVERSIONS)));<a name="line.178"></a>
-<span class="sourceLineNo">179</span>    }<a name="line.179"></a>
-<span class="sourceLineNo">180</span><a name="line.180"></a>
-<span class="sourceLineNo">181</span>    if (conf.get(SCAN_CACHEDROWS) != null) {<a name="line.181"></a>
-<span class="sourceLineNo">182</span>      scan.setCaching(Integer.parseInt(conf.get(SCAN_CACHEDROWS)));<a name="line.182"></a>
-<span class="sourceLineNo">183</span>    }<a name="line.183"></a>
-<span class="sourceLineNo">184</span><a name="line.184"></a>
-<span class="sourceLineNo">185</span>    if (conf.get(SCAN_BATCHSIZE) != null) {<a name="line.185"></a>
-<span class="sourceLineNo">186</span>      scan.setBatch(Integer.parseInt(conf.get(SCAN_BATCHSIZE)));<a name="line.186"></a>
-<span class="sourceLineNo">187</span>    }<a name="line.187"></a>
-<span class="sourceLineNo">188</span><a name="line.188"></a>
-<span class="sourceLineNo">189</span>    // false by default, full table scans generate too much BC churn<a name="line.189"></a>
-<span class="sourceLineNo">190</span>    scan.setCacheBlocks((conf.getBoolean(SCAN_CACHEBLOCKS, false)));<a name="line.190"></a>
-<span class="sourceLineNo">191</span><a name="line.191"></a>
-<span class="sourceLineNo">192</span>    return scan;<a name="line.192"></a>
-<span class="sourceLineNo">193</span>  }<a name="line.193"></a>
-<span class="sourceLineNo">194</span><a name="line.194"></a>
-<span class="sourceLineNo">195</span>  @Override<a name="line.195"></a>
-<span class="sourceLineNo">196</span>  protected void initialize(JobContext context) throws IOException {<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    // Do we have to worry about mis-matches between the Configuration from setConf and the one<a name="line.197"></a>
-<span class="sourceLineNo">198</span>    // in this context?<a name="line.198"></a>
-<span class="sourceLineNo">199</span>    TableName tableName = TableName.valueOf(conf.get(INPUT_TABLE));<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    try {<a name="line.200"></a>
-<span class="sourceLineNo">201</span>      initializeTable(ConnectionFactory.createConnection(new Configuration(conf)), tableName);<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    } catch (Exception e) {<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      LOG.error(StringUtils.stringifyException(e));<a name="line.203"></a>
-<span class="sourceLineNo">204</span>    }<a name="line.204"></a>
-<span class="sourceLineNo">205</span>  }<a name="line.205"></a>
-<span class="sourceLineNo">206</span><a name="line.206"></a>
-<span class="sourceLineNo">207</span>  /**<a name="line.207"></a>
-<span class="sourceLineNo">208</span>   * Parses a combined family and qualifier and adds either both or just the<a name="line.208"></a>
-<span class="sourceLineNo">209</span>   * family in case there is no qualifier. This assumes the older colon<a name="line.209"></a>
-<span class="sourceLineNo">210</span>   * divided notation, e.g. "family:qualifier".<a name="line.210"></a>
-<span class="sourceLineNo">211</span>   *<a name="line.211"></a>
-<span class="sourceLineNo">212</span>   * @param scan The Scan to update.<a name="line.212"></a>
-<span class="sourceLineNo">213</span>   * @param familyAndQualifier family and qualifier<a name="line.213"></a>
-<span class="sourceLineNo">214</span>   * @throws IllegalArgumentException When familyAndQualifier is invalid.<a name="line.214"></a>
-<span class="sourceLineNo">215</span>   */<a name="line.215"></a>
-<span class="sourceLineNo">216</span>  private static void addColumn(Scan scan, byte[] familyAndQualifier) {<a name="line.216"></a>
-<span class="sourceLineNo">217</span>    byte [][] fq = KeyValue.parseColumn(familyAndQualifier);<a name="line.217"></a>
-<span class="sourceLineNo">218</span>    if (fq.length == 1) {<a name="line.218"></a>
-<span class="sourceLineNo">219</span>      scan.addFamily(fq[0]);<a name="line.219"></a>
-<span class="sourceLineNo">220</span>    } else if (fq.length == 2) {<a name="line.220"></a>
-<span class="sourceLineNo">221</span>      scan.addColumn(fq[0], fq[1]);<a name="line.221"></a>
-<span class="sourceLineNo">222</span>    } else {<a name="line.222"></a>
-<span class="sourceLineNo">223</span>      throw new IllegalArgumentException("Invalid familyAndQualifier provided.");<a name="line.223"></a>
-<span class="sourceLineNo">224</span>    }<a name="line.224"></a>
-<span class="sourceLineNo">225</span>  }<a name="line.225"></a>
-<span class="sourceLineNo">226</span><a name="line.226"></a>
-<span class="sourceLineNo">227</span>  /**<a name="line.227"></a>
-<span class="sourceLineNo">228</span>   * Adds an array of columns specified using old format, family:qualifier.<a name="line.228"></a>
-<span class="sourceLineNo">229</span>   * &lt;p&gt;<a name="line.229"></a>
-<span class="sourceLineNo">230</span>   * Overrides previous calls to {@link Scan#addColumn(byte[], byte[])}for any families in the<a name="line.230"></a>
-<span class="sourceLineNo">231</span>   * input.<a name="line.231"></a>
-<span class="sourceLineNo">232</span>   *<a name="line.232"></a>
-<span class="sourceLineNo">233</span>   * @param scan The Scan to update.<a name="line.233"></a>
-<span class="sourceLineNo">234</span>   * @param columns array of columns, formatted as &lt;code&gt;family:qualifier&lt;/code&gt;<a name="line.234"></a>
-<span class="sourceLineNo">235</span>   * @see Scan#addColumn(byte[], byte[])<a name="line.235"></a>
-<span class="sourceLineNo">236</span>   */<a name="line.236"></a>
-<span class="sourceLineNo">237</span>  public static void addColumns(Scan scan, byte [][] columns) {<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    for (byte[] column : columns) {<a name="line.238"></a>
-<span class="sourceLineNo">239</span>      addColumn(scan, column);<a name="line.239"></a>
-<span class="sourceLineNo">240</span>    }<a name="line.240"></a>
-<span class="sourceLineNo">241</span>  }<a name="line.241"></a>
-<span class="sourceLineNo">242</span><a name="line.242"></a>
-<span class="sourceLineNo">243</span>  /**<a name="line.243"></a>
-<span class="sourceLineNo">244</span>   * Calculates the splits that will serve as input for the map tasks. The<a name="line.244"></a>
-<span class="sourceLineNo">245</span>   * number of splits matches the number of regions in a table. Splits are shuffled if<a name="line.245"></a>
-<span class="sourceLineNo">246</span>   * required.<a name="line.246"></a>
-<span class="sourceLineNo">247</span>   * @param context  The current job context.<a name="line.247"></a>
-<span class="sourceLineNo">248</span>   * @return The list of input splits.<a name="line.248"></a>
-<span class="sourceLineNo">249</span>   * @throws IOException When creating the list of splits fails.<a name="line.249"></a>
-<span class="sourceLineNo">250</span>   * @see org.apache.hadoop.mapreduce.InputFormat#getSplits(<a name="line.250"></a>
-<span class="sourceLineNo">251</span>   *   org.apache.hadoop.mapreduce.JobContext)<a name="line.251"></a>
-<span class="sourceLineNo">252</span>   */<a name="line.252"></a>
-<span class="sourceLineNo">253</span>  @Override<a name="line.253"></a>
-<span class="sourceLineNo">254</span>  public List&lt;InputSplit&gt; getSplits(JobContext context) throws IOException {<a name="line.254"></a>
-<span class="sourceLineNo">255</span>    List&lt;InputSplit&gt; splits = super.getSplits(context);<a name="line.255"></a>
-<span class="sourceLineNo">256</span>    if ((conf.get(SHUFFLE_MAPS) != null) &amp;&amp; "true".equals(conf.get(SHUFFLE_MAPS).toLowerCase())) {<a name="line.256"></a>
-<span class="sourceLineNo">257</span>      Collections.shuffle(splits);<a name="line.257"></a>
-<span class="sourceLineNo">258</span>    }<a name="line.258"></a>
-<span class="sourceLineNo">259</span>    return splits;<a name="line.259"></a>
-<span class="sourceLineNo">260</span>  }<a name="line.260"></a>
-<span class="sourceLineNo">261</span><a name="line.261"></a>
-<span class="sourceLineNo">262</span>  /**<a name="line.262"></a>
-<span class="sourceLineNo">263</span>   * Convenience method to parse a string representation of an array of column specifiers.<a name="line.263"></a>
-<span class="sourceLineNo">264</span>   *<a name="line.264"></a>
-<span class="sourceLineNo">265</span>   * @param scan The Scan to update.<a name="line.265"></a>
-<span class="sourceLineNo">266</span>   * @param columns  The columns to parse.<a name="line.266"></a>
-<span class="sourceLineNo">267</span>   */<a name="line.267"></a>
-<span class="sourceLineNo">268</span>  private static void addColumns(Scan scan, String columns) {<a name="line.268"></a>
-<span class="sourceLineNo">269</span>    String[] cols = columns.split(" ");<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    for (String col : cols) {<a name="line.270"></a>
-<span class="sourceLineNo">271</span>      addColumn(scan, Bytes.toBytes(col));<a name="line.271"></a>
-<span class="sourceLineNo">272</span>    }<a name="line.272"></a>
-<span class="sourceLineNo">273</span>  }<a name="line.273"></a>
-<span class="sourceLineNo">274</span><a name="line.274"></a>
-<span class="sourceLineNo">275</span>  @Override<a name="line.275"></a>
-<span class="sourceLineNo">276</span>  protected Pair&lt;byte[][], byte[][]&gt; getStartEndKeys() throws IOException {<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    if (conf.get(SPLIT_TABLE) != null) {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      TableName splitTableName = TableName.valueOf(conf.get(SPLIT_TABLE));<a name="line.278"></a>
-<span class="sourceLineNo">279</span>      try (Connection conn = ConnectionFactory.createConnection(getConf())) {<a name="line.279"></a>
-<span class="sourceLineNo">280</span>        try (RegionLocator rl = conn.getRegionLocator(splitTableName)) {<a name="line.280"></a>
-<span class="sourceLineNo">281</span>          return rl.getStartEndKeys();<a name="line.281"></a>
-<span class="sourceLineNo">282</span>        }<a name="line.282"></a>
-<span class="sourceLineNo">283</span>      }<a name="line.283"></a>
-<span class="sourceLineNo">284</span>    }<a name="line.284"></a>
-<span class="sourceLineNo">285</span><a name="line.285"></a>
-<span class="sourceLineNo">286</span>    return super.getStartEndKeys();<a name="line.286"></a>
-<span class="sourceLineNo">287</span>  }<a name="line.287"></a>
-<span class="sourceLineNo">288</span><a name="line.288"></a>
-<span class="sourceLineNo">289</span>  /**<a name="line.289"></a>
-<span class="sourceLineNo">290</span>   * Sets split table in map-reduce job.<a name="line.290"></a>
-<span class="sourceLineNo">291</span>   */<a name="line.291"></a>
-<span class="sourceLineNo">292</span>  public static void configureSplitTable(Job job, TableName tableName) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>    job.getConfiguration().set(SPLIT_TABLE, tableName.getNameAsString());<a name="line.293"></a>
-<span class="sourceLineNo">294</span>  }<a name="line.294"></a>
-<span class="sourceLineNo">295</span>}<a name="line.295"></a>
+<span class="sourceLineNo">024</span>import java.util.Locale;<a name="line.24"></a>
+<span class="sourceLineNo">025</span><a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.commons.logging.Log;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.commons.logging.LogFactory;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.conf.Configurable;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.conf.Configuration;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.KeyValue;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.TableName;<a name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.classification.InterfaceStability;<a name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.client.Connection;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.client.ConnectionFactory;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.client.RegionLocator;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.client.Scan;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.mapreduce.InputSplit;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.hadoop.mapreduce.JobContext;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.Pair;<a name="line.41"></a>
+<span class="sourceLineNo">042</span>import org.apache.hadoop.mapreduce.Job;<a name="line.42"></a>
+<span class="sourceLineNo">043</span>import org.apache.hadoop.util.StringUtils;<a name="line.43"></a>
+<span class="sourceLineNo">044</span><a name="line.44"></a>
+<span class="sourceLineNo">045</span>/**<a name="line.45"></a>
+<span class="sourceLineNo">046</span> * Convert HBase tabular data into a format that is consumable by Map/Reduce.<a name="line.46"></a>
+<span class="sourceLineNo">047</span> */<a name="line.47"></a>
+<span class="sourceLineNo">048</span>@InterfaceAudience.Public<a name="line.48"></a>
+<span class="sourceLineNo">049</span>@InterfaceStability.Stable<a name="line.49"></a>
+<span class="sourceLineNo">050</span>public class TableInputFormat extends TableInputFormatBase<a name="line.50"></a>
+<span class="sourceLineNo">051</span>implements Configurable {<a name="line.51"></a>
+<span class="sourceLineNo">052</span><a name="line.52"></a>
+<span class="sourceLineNo">053</span>  @SuppressWarnings("hiding")<a name="line.53"></a>
+<span class="sourceLineNo">054</span>  private static final Log LOG = LogFactory.getLog(TableInputFormat.class);<a name="line.54"></a>
+<span class="sourceLineNo">055</span><a name="line.55"></a>
+<span class="sourceLineNo">056</span>  /** Job parameter that specifies the input table. */<a name="line.56"></a>
+<span class="sourceLineNo">057</span>  public static final String INPUT_TABLE = "hbase.mapreduce.inputtable";<a name="line.57"></a>
+<span class="sourceLineNo">058</span>  /**<a name="line.58"></a>
+<span class="sourceLineNo">059</span>   * If specified, use start keys of this table to split.<a name="line.59"></a>
+<span class="sourceLineNo">060</span>   * This is useful when you are preparing data for bulkload.<a name="line.60"></a>
+<span class="sourceLineNo">061</span>   */<a name="line.61"></a>
+<span class="sourceLineNo">062</span>  private static final String SPLIT_TABLE = "hbase.mapreduce.splittable";<a name="line.62"></a>
+<span class="sourceLineNo">063</span>  /** Base-64 encoded scanner. All other SCAN_ confs are ignored if this is specified.<a name="line.63"></a>
+<span class="sourceLineNo">064</span>   * See {@link TableMapReduceUtil#convertScanToString(Scan)} for more details.<a name="line.64"></a>
+<span class="sourceLineNo">065</span>   */<a name="line.65"></a>
+<span class="sourceLineNo">066</span>  public static final String SCAN = "hbase.mapreduce.scan";<a name="line.66"></a>
+<span class="sourceLineNo">067</span>  /** Scan start row */<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  public static final String SCAN_ROW_START = "hbase.mapreduce.scan.row.start";<a name="line.68"></a>
+<span class="sourceLineNo">069</span>  /** Scan stop row */<a name="line.69"></a>
+<span class="sourceLineNo">070</span>  public static final String SCAN_ROW_STOP = "hbase.mapreduce.scan.row.stop";<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  /** Column Family to Scan */<a name="line.71"></a>
+<span class="sourceLineNo">072</span>  public static final String SCAN_COLUMN_FAMILY = "hbase.mapreduce.scan.column.family";<a name="line.72"></a>
+<span class="sourceLineNo">073</span>  /** Space delimited list of columns and column families to scan. */<a name="line.73"></a>
+<span class="sourceLineNo">074</span>  public static final String SCAN_COLUMNS = "hbase.mapreduce.scan.columns";<a name="line.74"></a>
+<span class="sourceLineNo">075</span>  /** The timestamp used to filter columns with a specific timestamp. */<a name="line.75"></a>
+<span class="sourceLineNo">076</span>  public static final String SCAN_TIMESTAMP = "hbase.mapreduce.scan.timestamp";<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  /** The starting timestamp used to filter columns with a specific range of versions. */<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  public static final String SCAN_TIMERANGE_START = "hbase.mapreduce.scan.timerange.start";<a name="line.78"></a>
+<span class="sourceLineNo">079</span>  /** The ending timestamp used to filter columns with a specific range of versions. */<a name="line.79"></a>
+<span class="sourceLineNo">080</span>  public static final String SCAN_TIMERANGE_END = "hbase.mapreduce.scan.timerange.end";<a name="line.80"></a>
+<span class="sourceLineNo">081</span>  /** The maximum number of version to return. */<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  public static final String SCAN_MAXVERSIONS = "hbase.mapreduce.scan.maxversions";<a name="line.82"></a>
+<span class="sourceLineNo">083</span>  /** Set to false to disable server-side caching of blocks for this scan. */<a name="line.83"></a>
+<span class="sourceLineNo">084</span>  public static final String SCAN_CACHEBLOCKS = "hbase.mapreduce.scan.cacheblocks";<a name="line.84"></a>
+<span class="sourceLineNo">085</span>  /** The number of rows for caching that will be passed to scanners. */<a name="line.85"></a>
+<span class="sourceLineNo">086</span>  public static final String SCAN_CACHEDROWS = "hbase.mapreduce.scan.cachedrows";<a name="line.86"></a>
+<span class="sourceLineNo">087</span>  /** Set the maximum number of values to return for each call to next(). */<a name="line.87"></a>
+<span class="sourceLineNo">088</span>  public static final String SCAN_BATCHSIZE = "hbase.mapreduce.scan.batchsize";<a name="line.88"></a>
+<span class="sourceLineNo">089</span>  /** Specify if we have to shuffle the map tasks. */<a name="line.89"></a>
+<span class="sourceLineNo">090</span>  public static final String SHUFFLE_MAPS = "hbase.mapreduce.inputtable.shufflemaps";<a name="line.90"></a>
+<span class="sourceLineNo">091</span><a name="line.91"></a>
+<span class="sourceLineNo">092</span>  /** The configuration. */<a name="line.92"></a>
+<span class="sourceLineNo">093</span>  private Configuration conf = null;<a name="line.93"></a>
+<span class="sourceLineNo">094</span><a name="line.94"></a>
+<span class="sourceLineNo">095</span>  /**<a name="line.95"></a>
+<span class="sourceLineNo">096</span>   * Returns the current configuration.<a name="line.96"></a>
+<span class="sourceLineNo">097</span>   *<a name="line.97"></a>
+<span class="sourceLineNo">098</span>   * @return The current configuration.<a name="line.98"></a>
+<span class="sourceLineNo">099</span>   * @see org.apache.hadoop.conf.Configurable#getConf()<a name="line.99"></a>
+<span class="sourceLineNo">100</span>   */<a name="line.100"></a>
+<span class="sourceLineNo">101</span>  @Override<a name="line.101"></a>
+<span class="sourceLineNo">102</span>  public Configuration getConf() {<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    return conf;<a name="line.103"></a>
+<span class="sourceLineNo">104</span>  }<a name="line.104"></a>
+<span class="sourceLineNo">105</span><a name="line.105"></a>
+<span class="sourceLineNo">106</span>  /**<a name="line.106"></a>
+<span class="sourceLineNo">107</span>   * Sets the configuration. This is used to set the details for the table to<a name="line.107"></a>
+<span class="sourceLineNo">108</span>   * be scanned.<a name="line.108"></a>
+<span class="sourceLineNo">109</span>   *<a name="line.109"></a>
+<span class="sourceLineNo">110</span>   * @param configuration  The configuration to set.<a name="line.110"></a>
+<span class="sourceLineNo">111</span>   * @see org.apache.hadoop.conf.Configurable#setConf(<a name="line.111"></a>
+<span class="sourceLineNo">112</span>   *   org.apache.hadoop.conf.Configuration)<a name="line.112"></a>
+<span class="sourceLineNo">113</span>   */<a name="line.113"></a>
+<span class="sourceLineNo">114</span>  @Override<a name="line.114"></a>
+<span class="sourceLineNo">115</span>  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="REC_CATCH_EXCEPTION",<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    justification="Intentional")<a name="line.116"></a>
+<span class="sourceLineNo">117</span>  public void setConf(Configuration configuration) {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>    this.conf = configuration;<a name="line.118"></a>
+<span class="sourceLineNo">119</span><a name="line.119"></a>
+<span class="sourceLineNo">120</span>    Scan scan = null;<a name="line.120"></a>
+<span class="sourceLineNo">121</span><a name="line.121"></a>
+<span class="sourceLineNo">122</span>    if (conf.get(SCAN) != null) {<a name="line.122"></a>
+<span class="sourceLineNo">123</span>      try {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>        scan = TableMapReduceUtil.convertStringToScan(conf.get(SCAN));<a name="line.124"></a>
+<span class="sourceLineNo">125</span>      } catch (IOException e) {<a name="line.125"></a>
+<span class="sourceLineNo">126</span>        LOG.error("An error occurred.", e);<a name="line.126"></a>
+<span class="sourceLineNo">127</span>      }<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    } else {<a name="line.128"></a>
+<span class="sourceLineNo">129</span>      try {<a name="line.129"></a>
+<span class="sourceLineNo">130</span>        scan = createScanFromConfiguration(conf);<a name="line.130"></a>
+<span class="sourceLineNo">131</span>      } catch (Exception e) {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>          LOG.error(StringUtils.stringifyException(e));<a name="line.132"></a>
+<span class="sourceLineNo">133</span>      }<a name="line.133"></a>
+<span class="sourceLineNo">134</span>    }<a name="line.134"></a>
+<span class="sourceLineNo">135</span><a name="line.135"></a>
+<span class="sourceLineNo">136</span>    setScan(scan);<a name="line.136"></a>
+<span class="sourceLineNo">137</span>  }<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span>  /**<a name="line.139"></a>
+<span class="sourceLineNo">140</span>   * Sets up a {@link Scan} instance, applying settings from the configuration property<a name="line.140"></a>
+<span class="sourceLineNo">141</span>   * constants defined in {@code TableInputFormat}.  This allows specifying things such as:<a name="line.141"></a>
+<span class="sourceLineNo">142</span>   * &lt;ul&gt;<a name="line.142"></a>
+<span class="sourceLineNo">143</span>   *   &lt;li&gt;start and stop rows&lt;/li&gt;<a name="line.143"></a>
+<span class="sourceLineNo">144</span>   *   &lt;li&gt;column qualifiers or families&lt;/li&gt;<a name="line.144"></a>
+<span class="sourceLineNo">145</span>   *   &lt;li&gt;timestamps or timerange&lt;/li&gt;<a name="line.145"></a>
+<span class="sourceLineNo">146</span>   *   &lt;li&gt;scanner caching and batch size&lt;/li&gt;<a name="line.146"></a>
+<span class="sourceLineNo">147</span>   * &lt;/ul&gt;<a name="line.147"></a>
+<span class="sourceLineNo">148</span>   */<a name="line.148"></a>
+<span class="sourceLineNo">149</span>  public static Scan createScanFromConfiguration(Configuration conf) throws IOException {<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    Scan scan = new Scan();<a name="line.150"></a>
+<span class="sourceLineNo">151</span><a name="line.151"></a>
+<span class="sourceLineNo">152</span>    if (conf.get(SCAN_ROW_START) != null) {<a name="line.152"></a>
+<span class="sourceLineNo">153</span>      scan.setStartRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_START)));<a name="line.153"></a>
+<span class="sourceLineNo">154</span>    }<a name="line.154"></a>
+<span class="sourceLineNo">155</span><a name="line.155"></a>
+<span class="sourceLineNo">156</span>    if (conf.get(SCAN_ROW_STOP) != null) {<a name="line.156"></a>
+<span class="sourceLineNo">157</span>      scan.setStopRow(Bytes.toBytesBinary(conf.get(SCAN_ROW_STOP)));<a name="line.157"></a>
+<span class="sourceLineNo">158</span>    }<a name="line.158"></a>
+<span class="sourceLineNo">159</span><a name="line.159"></a>
+<span class="sourceLineNo">160</span>    if (conf.get(SCAN_COLUMNS) != null) {<a name="line.160"></a>
+<span class="sourceLineNo">161</span>      addColumns(scan, conf.get(SCAN_COLUMNS));<a name="line.161"></a>
+<span class="sourceLineNo">162</span>    }<a name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>    if (conf.get(SCAN_COLUMN_FAMILY) != null) {<a name="line.164"></a>
+<span class="sourceLineNo">165</span>      scan.addFamily(Bytes.toBytes(conf.get(SCAN_COLUMN_FAMILY)));<a name="line.165"></a>
+<span class="sourceLineNo">166</span>    }<a name="line.166"></a>
+<span class="sourceLineNo">167</span><a name="line.167"></a>
+<span class="sourceLineNo">168</span>    if (conf.get(SCAN_TIMESTAMP) != null) {<a name="line.168"></a>
+<span class="sourceLineNo">169</span>      scan.setTimeStamp(Long.parseLong(conf.get(SCAN_TIMESTAMP)));<a name="line.169"></a>
+<span class="sourceLineNo">170</span>    }<a name="line.170"></a>
+<span class="sourceLineNo">171</span><a name="line.171"></a>
+<span class="sourceLineNo">172</span>    if (conf.get(SCAN_TIMERANGE_START) != null &amp;&amp; conf.get(SCAN_TIMERANGE_END) != null) {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>      scan.setTimeRange(<a name="line.173"></a>
+<span class="sourceLineNo">174</span>          Long.parseLong(conf.get(SCAN_TIMERANGE_START)),<a name="line.174"></a>
+<span class="sourceLineNo">175</span>          Long.parseLong(conf.get(SCAN_TIMERANGE_END)));<a name="line.175"></a>
+<span class="sourceLineNo">176</span>    }<a name="line.176"></a>
+<span class="sourceLineNo">177</span><a name="line.177"></a>
+<span class="sourceLineNo">178</span>    if (conf.get(SCAN_MAXVERSIONS) != null) {<a name="line.178"></a>
+<span class="sourceLineNo">179</span>      scan.setMaxVersions(Integer.parseInt(conf.get(SCAN_MAXVERSIONS)));<a name="line.179"></a>
+<span class="sourceLineNo">180</span>    }<a name="line.180"></a>
+<span class="sourceLineNo">181</span><a name="line.181"></a>
+<span class="sourceLineNo">182</span>    if (conf.get(SCAN_CACHEDROWS) != null) {<a name="line.182"></a>
+<span class="sourceLineNo">183</span>      scan.setCaching(Integer.parseInt(conf.get(SCAN_CACHEDROWS)));<a name="line.183"></a>
+<span class="sourceLineNo">184</span>    }<a name="line.184"></a>
+<span class="sourceLineNo">185</span><a name="line.185"></a>
+<span class="sourceLineNo">186</span>    if (conf.get(SCAN_BATCHSIZE) != null) {<a name="line.186"></a>
+<span class="sourceLineNo">187</span>      scan.setBatch(Integer.parseInt(conf.get(SCAN_BATCHSIZE)));<a name="line.187"></a>
+<span class="sourceLineNo">188</span>    }<a name="line.188"></a>
+<span class="sourceLineNo">189</span><a name="line.189"></a>
+<span class="sourceLineNo">190</span>    // false by default, full table scans generate too much BC churn<a name="line.190"></a>
+<span class="sourceLineNo">191</span>    scan.setCacheBlocks((conf.getBoolean(SCAN_CACHEBLOCKS, false)));<a name="line.191"></a>
+<span class="sourceLineNo">192</span><a name="line.192"></a>
+<span class="sourceLineNo">193</span>    return scan;<a name="line.193"></a>
+<span class="sourceLineNo">194</span>  }<a name="line.194"></a>
+<span class="sourceLineNo">195</span><a name="line.195"></a>
+<span class="sourceLineNo">196</span>  @Override<a name="line.196"></a>
+<span class="sourceLineNo">197</span>  protected void initialize(JobContext context) throws IOException {<a name="line.197"></a>
+<span class="sourceLineNo">198</span>    // Do we have to worry about mis-matches between the Configuration from setConf and the one<a name="line.198"></a>
+<span class="sourceLineNo">199</span>    // in this context?<a name="line.199"></a>
+<span class="sourceLineNo">200</span>    TableName tableName = TableName.valueOf(conf.get(INPUT_TABLE));<a name="line.200"></a>
+<span class="sourceLineNo">201</span>    try {<a name="line.201"></a>
+<span class="sourceLineNo">202</span>      initializeTable(ConnectionFactory.createConnection(new Configuration(conf)), tableName);<a name="line.202"></a>
+<span class="sourceLineNo">203</span>    } catch (Exception e) {<a name="line.203"></a>
+<span class="sourceLineNo">204</span>      LOG.error(StringUtils.stringifyException(e));<a name="line.204"></a>
+<span class="sourceLineNo">205</span>    }<a name="line.205"></a>
+<span class="sourceLineNo">206</span>  }<a name="line.206"></a>
+<span class="sourceLineNo">207</span><a name="line.207"></a>
+<span class="sourceLineNo">208</span>  /**<a name="line.208"></a>
+<span class="sourceLineNo">209</span>   * Parses a combined family and qualifier and adds either both or just the<a name="line.209"></a>
+<span class="sourceLineNo">210</span>   * family in case there is no qualifier. This assumes the older colon<a name="line.210"></a>
+<span class="sourceLineNo">211</span>   * divided notation, e.g. "family:qualifier".<a name="line.211"></a>
+<span class="sourceLineNo">212</span>   *<a name="line.212"></a>
+<span class="sourceLineNo">213</span>   * @param scan The Scan to update.<a name="line.213"></a>
+<span class="sourceLineNo">214</span>   * @param familyAndQualifier family and qualifier<a name="line.214"></a>
+<span class="sourceLineNo">215</span>   * @throws IllegalArgumentException When familyAndQualifier is invalid.<a name="line.215"></a>
+<span class="sourceLineNo">216</span>   */<a name="line.216"></a>
+<span class="sourceLineNo">217</span>  private static void addColumn(Scan scan, byte[] familyAndQualifier) {<a name="line.217"></a>
+<span class="sourceLineNo">218</span>    byte [][] fq = KeyValue.parseColumn(familyAndQualifier);<a name="line.218"></a>
+<span class="sourceLineNo">219</span>    if (fq.length == 1) {<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      scan.addFamily(fq[0]);<a name="line.220"></a>
+<span class="sourceLineNo">221</span>    } else if (fq.length == 2) {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      scan.addColumn(fq[0], fq[1]);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>    } else {<a name="line.223"></a>
+<span class="sourceLineNo">224</span>      throw new IllegalArgumentException("Invalid familyAndQualifier provided.");<a name="line.224"></a>
+<span class="sourceLineNo">225</span>    }<a name="line.225"></a>
+<span class="sourceLineNo">226</span>  }<a name="line.226"></a>
+<span class="sourceLineNo">227</span><a name="line.227"></a>
+<span class="sourceLineNo">228</span>  /**<a name="line.228"></a>
+<span class="sourceLineNo">229</span>   * Adds an array of columns specified using old format, family:qualifier.<a name="line.229"></a>
+<span class="sourceLineNo">230</span>   * &lt;p&gt;<a name="line.230"></a>
+<span class="sourceLineNo">231</span>   * Overrides previous calls to {@link Scan#addColumn(byte[], byte[])}for any families in the<a name="line.231"></a>
+<span class="sourceLineNo">232</span>   * input.<a name="line.232"></a>
+<span class="sourceLineNo">233</span>   *<a name="line.233"></a>
+<span class="sourceLineNo">234</span>   * @param scan The Scan to update.<a name="line.234"></a>
+<span class="sourceLineNo">235</span>   * @param columns array of columns, formatted as &lt;code&gt;family:qualifier&lt;/code&gt;<a name="line.235"></a>
+<span class="sourceLineNo">236</span>   * @see Scan#addColumn(byte[], byte[])<a name="line.236"></a>
+<span class="sourceLineNo">237</span>   */<a name="line.237"></a>
+<span class="sourceLineNo">238</span>  public static void addColumns(Scan scan, byte [][] columns) {<a name="line.238"></a>
+<span class="sourceLineNo">239</span>    for (byte[] column : columns) {<a name="line.239"></a>
+<span class="sourceLineNo">240</span>      addColumn(scan, column);<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    }<a name="line.241"></a>
+<span class="sourceLineNo">242</span>  }<a name="line.242"></a>
+<span class="sourceLineNo">243</span><a name="line.243"></a>
+<span class="sourceLineNo">244</span>  /**<a name="line.244"></a>
+<span class="sourceLineNo">245</span>   * Calculates the splits that will serve as input for the map tasks. The<a name="line.245"></a>
+<span class="sourceLineNo">246</span>   * number of splits matches the number of regions in a table. Splits are shuffled if<a name="line.246"></a>
+<span class="sourceLineNo">247</span>   * required.<a name="line.247"></a>
+<span class="sourceLineNo">248</span>   * @param context  The current job context.<a name="line.248"></a>
+<span class="sourceLineNo">249</span>   * @return The list of input splits.<a name="line.249"></a>
+<span class="sourceLineNo">250</span>   * @throws IOException When creating the list of splits fails.<a name="line.250"></a>
+<span class="sourceLineNo">251</span>   * @see org.apache.hadoop.mapreduce.InputFormat#getSplits(<a name="line.251"></a>
+<span class="sourceLineNo">252</span>   *   org.apache.hadoop.mapreduce.JobContext)<a name="line.252"></a>
+<span class="sourceLineNo">253</span>   */<a name="line.253"></a>
+<span class="sourceLineNo">254</span>  @Override<a name="line.254"></a>
+<span class="sourceLineNo">255</span>  public List&lt;InputSplit&gt; getSplits(JobContext context) throws IOException {<a name="line.255"></a>
+<span class="sourceLineNo">256</span>    List&lt;InputSplit&gt; splits = super.getSplits(context);<a name="line.256"></a>
+<span class="sourceLineNo">257</span>    if ((conf.get(SHUFFLE_MAPS) != null) &amp;&amp; "true".equals(conf.get(SHUFFLE_MAPS).toLowerCase(Locale.ROOT))) {<a name="line.257"></a>
+<span class="sourceLineNo">258</span>      Collections.shuffle(splits);<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    }<a name="line.259"></a>
+<span class="sourceLineNo">260</span>    return splits;<a name="line.260"></a>
+<span class="sourceLineNo">261</span>  }<a name="line.261"></a>
+<span class="sourceLineNo">262</span><a name="line.262"></a>
+<span class="sourceLineNo">263</span>  /**<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   * Convenience method to parse a string representation of an array of column specifiers.<a name="line.264"></a>
+<span class="sourceLineNo">265</span>   *<a name="line.265"></a>
+<span class="sourceLineNo">266</span>   * @param scan The Scan to update.<a name="line.266"></a>
+<span class="sourceLineNo">267</span>   * @param columns  The columns to parse.<a name="line.267"></a>
+<span class="sourceLineNo">268</span>   */<a name="line.268"></a>
+<span class="sourceLineNo">269</span>  private static void addColumns(Scan scan, String columns) {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>    String[] cols = columns.split(" ");<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    for (String col : cols) {<a name="line.271"></a>
+<span class="sourceLineNo">272</span>      addColumn(scan, Bytes.toBytes(col));<a name="line.272"></a>
+<span class="sourceLineNo">273</span>    }<a name="line.273"></a>
+<span class="sourceLineNo">274</span>  }<a name="line.274"></a>
+<span class="sourceLineNo">275</span><a name="line.275"></a>
+<span class="sourceLineNo">276</span>  @Override<a name="line.276"></a>
+<span class="sourceLineNo">277</span>  protected Pair&lt;byte[][], byte[][]&gt; getStartEndKeys() throws IOException {<a name="line.277"></a>
+<span class="sourceLineNo">278</span>    if (conf.get(SPLIT_TABLE) != null) {<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      TableName splitTableName = TableName.valueOf(conf.get(SPLIT_TABLE));<a name="line.279"></a>
+<span class="sourceLineNo">280</span>      try (Connection conn = ConnectionFactory.createConnection(getConf())) {<a name="line.280"></a>
+<span class="sourceLineNo">281</span>        try (RegionLocator rl = conn.getRegionLocator(splitTableName)) {<a name="line.281"></a>
+<span class="sourceLineNo">282</span>          return rl.getStartEndKeys();<a name="line.282"></a>
+<span class="sourceLineNo">283</span>        }<a name="line.283"></a>
+<span class="sourceLineNo">284</span>      }<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    }<a name="line.285"></a>
+<span class="sourceLineNo">286</span><a name="line.286"></a>
+<span class="sourceLineNo">287</span>    return super.getStartEndKeys();<a name="line.287"></a>
+<span class="sourceLineNo">288</span>  }<a name="line.288"></a>
+<span class="sourceLineNo">289</span><a name="line.289"></a>
+<span class="sourceLineNo">290</span>  /**<a name="line.290"></a>
+<span class="sourceLineNo">291</span>   * Sets split table in map-reduce job.<a name="line.291"></a>
+<span class="sourceLineNo">292</span>   */<a name="line.292"></a>
+<span class="sourceLineNo">293</span>  public static void configureSplitTable(Job job, TableName tableName) {<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    job.getConfiguration().set(SPLIT_TABLE, tableName.getNameAsString());<a name="line.294"></a>
+<span class="sourceLineNo">295</span>  }<a name="line.295"></a>
+<span class="sourceLineNo">296</span>}<a name="line.296"></a>
 
 
 


Mime
View raw message