http://git-wip-us.apache.org/repos/asf/hbase-site/blob/00c22388/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html b/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html index 0af43de..c6abac8 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/filter/TimestampsFilter.html @@ -116,127 +116,133 @@ <span class="sourceLineNo">108</span> return false;<a name="line.108"></a> <span class="sourceLineNo">109</span> }<a name="line.109"></a> <span class="sourceLineNo">110</span><a name="line.110"></a> -<span class="sourceLineNo">111</span> @Override<a name="line.111"></a> -<span class="sourceLineNo">112</span> public ReturnCode filterKeyValue(Cell v) {<a name="line.112"></a> -<span class="sourceLineNo">113</span> if (this.timestamps.contains(v.getTimestamp())) {<a name="line.113"></a> -<span class="sourceLineNo">114</span> return ReturnCode.INCLUDE;<a name="line.114"></a> -<span class="sourceLineNo">115</span> } else if (v.getTimestamp() < minTimeStamp) {<a name="line.115"></a> -<span class="sourceLineNo">116</span> // The remaining versions of this column are guaranteed<a name="line.116"></a> -<span class="sourceLineNo">117</span> // to be lesser than all of the other values.<a name="line.117"></a> -<span class="sourceLineNo">118</span> return ReturnCode.NEXT_COL;<a name="line.118"></a> -<span class="sourceLineNo">119</span> }<a name="line.119"></a> -<span class="sourceLineNo">120</span> return canHint ? ReturnCode.SEEK_NEXT_USING_HINT : ReturnCode.SKIP;<a name="line.120"></a> -<span class="sourceLineNo">121</span> }<a name="line.121"></a> -<span class="sourceLineNo">122</span><a name="line.122"></a> -<span class="sourceLineNo">123</span><a name="line.123"></a> -<span class="sourceLineNo">124</span> /**<a name="line.124"></a> -<span class="sourceLineNo">125</span> * Pick the next cell that the scanner should seek to. Since this can skip any number of cells<a name="line.125"></a> -<span class="sourceLineNo">126</span> * any of which can be a delete this can resurect old data.<a name="line.126"></a> -<span class="sourceLineNo">127</span> *<a name="line.127"></a> -<span class="sourceLineNo">128</span> * The method will only be used if canHint was set to true while creating the filter.<a name="line.128"></a> -<span class="sourceLineNo">129</span> *<a name="line.129"></a> -<span class="sourceLineNo">130</span> * @throws IOException This will never happen.<a name="line.130"></a> -<span class="sourceLineNo">131</span> */<a name="line.131"></a> -<span class="sourceLineNo">132</span> public Cell getNextCellHint(Cell currentCell) throws IOException {<a name="line.132"></a> -<span class="sourceLineNo">133</span> if (!canHint) {<a name="line.133"></a> -<span class="sourceLineNo">134</span> return null;<a name="line.134"></a> -<span class="sourceLineNo">135</span> }<a name="line.135"></a> -<span class="sourceLineNo">136</span><a name="line.136"></a> -<span class="sourceLineNo">137</span> Long nextTimestampObject = timestamps.lower(currentCell.getTimestamp());<a name="line.137"></a> -<span class="sourceLineNo">138</span><a name="line.138"></a> -<span class="sourceLineNo">139</span> if (nextTimestampObject == null) {<a name="line.139"></a> -<span class="sourceLineNo">140</span> // This should only happen if the current column's<a name="line.140"></a> -<span class="sourceLineNo">141</span> // timestamp is below the last one in the list.<a name="line.141"></a> -<span class="sourceLineNo">142</span> //<a name="line.142"></a> -<span class="sourceLineNo">143</span> // It should never happen as the filterKeyValue should return NEXT_COL<a name="line.143"></a> -<span class="sourceLineNo">144</span> // but it's always better to be extra safe and protect against future<a name="line.144"></a> -<span class="sourceLineNo">145</span> // behavioral changes.<a name="line.145"></a> -<span class="sourceLineNo">146</span><a name="line.146"></a> -<span class="sourceLineNo">147</span> return CellUtil.createLastOnRowCol(currentCell);<a name="line.147"></a> -<span class="sourceLineNo">148</span> }<a name="line.148"></a> -<span class="sourceLineNo">149</span><a name="line.149"></a> -<span class="sourceLineNo">150</span> // Since we know the nextTimestampObject isn't null here there must still be<a name="line.150"></a> -<span class="sourceLineNo">151</span> // timestamps that can be included. Cast the Long to a long and return the<a name="line.151"></a> -<span class="sourceLineNo">152</span> // a cell with the current row/cf/col and the next found timestamp.<a name="line.152"></a> -<span class="sourceLineNo">153</span> long nextTimestamp = nextTimestampObject;<a name="line.153"></a> -<span class="sourceLineNo">154</span> return CellUtil.createFirstOnRowColTS(currentCell, nextTimestamp);<a name="line.154"></a> -<span class="sourceLineNo">155</span> }<a name="line.155"></a> -<span class="sourceLineNo">156</span><a name="line.156"></a> -<span class="sourceLineNo">157</span> public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {<a name="line.157"></a> -<span class="sourceLineNo">158</span> ArrayList<Long> timestamps = new ArrayList<>(filterArguments.size());<a name="line.158"></a> -<span class="sourceLineNo">159</span> for (int i = 0; i<filterArguments.size(); i++) {<a name="line.159"></a> -<span class="sourceLineNo">160</span> long timestamp = ParseFilter.convertByteArrayToLong(filterArguments.get(i));<a name="line.160"></a> -<span class="sourceLineNo">161</span> timestamps.add(timestamp);<a name="line.161"></a> -<span class="sourceLineNo">162</span> }<a name="line.162"></a> -<span class="sourceLineNo">163</span> return new TimestampsFilter(timestamps);<a name="line.163"></a> -<span class="sourceLineNo">164</span> }<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> * @return The filter serialized using pb<a name="line.167"></a> -<span class="sourceLineNo">168</span> */<a name="line.168"></a> -<span class="sourceLineNo">169</span> public byte[] toByteArray() {<a name="line.169"></a> -<span class="sourceLineNo">170</span> FilterProtos.TimestampsFilter.Builder builder =<a name="line.170"></a> -<span class="sourceLineNo">171</span> FilterProtos.TimestampsFilter.newBuilder();<a name="line.171"></a> -<span class="sourceLineNo">172</span> builder.addAllTimestamps(this.timestamps);<a name="line.172"></a> -<span class="sourceLineNo">173</span> builder.setCanHint(canHint);<a name="line.173"></a> -<span class="sourceLineNo">174</span> return builder.build().toByteArray();<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> /**<a name="line.177"></a> -<span class="sourceLineNo">178</span> * @param pbBytes A pb serialized {@link TimestampsFilter} instance<a name="line.178"></a> -<span class="sourceLineNo">179</span> *<a name="line.179"></a> -<span class="sourceLineNo">180</span> * @return An instance of {@link TimestampsFilter} made from <code>bytes</code><a name="line.180"></a> -<span class="sourceLineNo">181</span> * @see #toByteArray<a name="line.181"></a> -<span class="sourceLineNo">182</span> */<a name="line.182"></a> -<span class="sourceLineNo">183</span> public static TimestampsFilter parseFrom(final byte[] pbBytes)<a name="line.183"></a> -<span class="sourceLineNo">184</span> throws DeserializationException {<a name="line.184"></a> -<span class="sourceLineNo">185</span> FilterProtos.TimestampsFilter proto;<a name="line.185"></a> -<span class="sourceLineNo">186</span> try {<a name="line.186"></a> -<span class="sourceLineNo">187</span> proto = FilterProtos.TimestampsFilter.parseFrom(pbBytes);<a name="line.187"></a> -<span class="sourceLineNo">188</span> } catch (InvalidProtocolBufferException e) {<a name="line.188"></a> -<span class="sourceLineNo">189</span> throw new DeserializationException(e);<a name="line.189"></a> -<span class="sourceLineNo">190</span> }<a name="line.190"></a> -<span class="sourceLineNo">191</span> return new TimestampsFilter(proto.getTimestampsList(),<a name="line.191"></a> -<span class="sourceLineNo">192</span> proto.hasCanHint() && proto.getCanHint());<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> /**<a name="line.195"></a> -<span class="sourceLineNo">196</span> * @param other<a name="line.196"></a> -<span class="sourceLineNo">197</span> * @return true if and only if the fields of the filter that are serialized<a name="line.197"></a> -<span class="sourceLineNo">198</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.198"></a> -<span class="sourceLineNo">199</span> */<a name="line.199"></a> -<span class="sourceLineNo">200</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.200"></a> -<span class="sourceLineNo">201</span> if (o == this) return true;<a name="line.201"></a> -<span class="sourceLineNo">202</span> if (!(o instanceof TimestampsFilter)) return false;<a name="line.202"></a> -<span class="sourceLineNo">203</span><a name="line.203"></a> -<span class="sourceLineNo">204</span> TimestampsFilter other = (TimestampsFilter)o;<a name="line.204"></a> -<span class="sourceLineNo">205</span> return this.getTimestamps().equals(other.getTimestamps());<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> @Override<a name="line.208"></a> -<span class="sourceLineNo">209</span> public String toString() {<a name="line.209"></a> -<span class="sourceLineNo">210</span> return toString(MAX_LOG_TIMESTAMPS);<a name="line.210"></a> -<span class="sourceLineNo">211</span> }<a name="line.211"></a> -<span class="sourceLineNo">212</span><a name="line.212"></a> -<span class="sourceLineNo">213</span> protected String toString(int maxTimestamps) {<a name="line.213"></a> -<span class="sourceLineNo">214</span> StringBuilder tsList = new StringBuilder();<a name="line.214"></a> -<span class="sourceLineNo">215</span><a name="line.215"></a> -<span class="sourceLineNo">216</span> int count = 0;<a name="line.216"></a> -<span class="sourceLineNo">217</span> for (Long ts : this.timestamps) {<a name="line.217"></a> -<span class="sourceLineNo">218</span> if (count >= maxTimestamps) {<a name="line.218"></a> -<span class="sourceLineNo">219</span> break;<a name="line.219"></a> -<span class="sourceLineNo">220</span> }<a name="line.220"></a> -<span class="sourceLineNo">221</span> ++count;<a name="line.221"></a> -<span class="sourceLineNo">222</span> tsList.append(ts.toString());<a name="line.222"></a> -<span class="sourceLineNo">223</span> if (count < this.timestamps.size() && count < maxTimestamps) {<a name="line.223"></a> -<span class="sourceLineNo">224</span> tsList.append(", ");<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> return String.format("%s (%d/%d): [%s] canHint: [%b]", this.getClass().getSimpleName(),<a name="line.228"></a> -<span class="sourceLineNo">229</span> count, this.timestamps.size(), tsList.toString(), canHint);<a name="line.229"></a> -<span class="sourceLineNo">230</span> }<a name="line.230"></a> -<span class="sourceLineNo">231</span>}<a name="line.231"></a> +<span class="sourceLineNo">111</span> @Deprecated<a name="line.111"></a> +<span class="sourceLineNo">112</span> @Override<a name="line.112"></a> +<span class="sourceLineNo">113</span> public ReturnCode filterKeyValue(final Cell c) {<a name="line.113"></a> +<span class="sourceLineNo">114</span> return filterCell(c);<a name="line.114"></a> +<span class="sourceLineNo">115</span> }<a name="line.115"></a> +<span class="sourceLineNo">116</span><a name="line.116"></a> +<span class="sourceLineNo">117</span> @Override<a name="line.117"></a> +<span class="sourceLineNo">118</span> public ReturnCode filterCell(final Cell c) {<a name="line.118"></a> +<span class="sourceLineNo">119</span> if (this.timestamps.contains(c.getTimestamp())) {<a name="line.119"></a> +<span class="sourceLineNo">120</span> return ReturnCode.INCLUDE;<a name="line.120"></a> +<span class="sourceLineNo">121</span> } else if (c.getTimestamp() < minTimeStamp) {<a name="line.121"></a> +<span class="sourceLineNo">122</span> // The remaining versions of this column are guaranteed<a name="line.122"></a> +<span class="sourceLineNo">123</span> // to be lesser than all of the other values.<a name="line.123"></a> +<span class="sourceLineNo">124</span> return ReturnCode.NEXT_COL;<a name="line.124"></a> +<span class="sourceLineNo">125</span> }<a name="line.125"></a> +<span class="sourceLineNo">126</span> return canHint ? ReturnCode.SEEK_NEXT_USING_HINT : ReturnCode.SKIP;<a name="line.126"></a> +<span class="sourceLineNo">127</span> }<a name="line.127"></a> +<span class="sourceLineNo">128</span><a name="line.128"></a> +<span class="sourceLineNo">129</span><a name="line.129"></a> +<span class="sourceLineNo">130</span> /**<a name="line.130"></a> +<span class="sourceLineNo">131</span> * Pick the next cell that the scanner should seek to. Since this can skip any number of cells<a name="line.131"></a> +<span class="sourceLineNo">132</span> * any of which can be a delete this can resurect old data.<a name="line.132"></a> +<span class="sourceLineNo">133</span> *<a name="line.133"></a> +<span class="sourceLineNo">134</span> * The method will only be used if canHint was set to true while creating the filter.<a name="line.134"></a> +<span class="sourceLineNo">135</span> *<a name="line.135"></a> +<span class="sourceLineNo">136</span> * @throws IOException This will never happen.<a name="line.136"></a> +<span class="sourceLineNo">137</span> */<a name="line.137"></a> +<span class="sourceLineNo">138</span> public Cell getNextCellHint(Cell currentCell) throws IOException {<a name="line.138"></a> +<span class="sourceLineNo">139</span> if (!canHint) {<a name="line.139"></a> +<span class="sourceLineNo">140</span> return null;<a name="line.140"></a> +<span class="sourceLineNo">141</span> }<a name="line.141"></a> +<span class="sourceLineNo">142</span><a name="line.142"></a> +<span class="sourceLineNo">143</span> Long nextTimestampObject = timestamps.lower(currentCell.getTimestamp());<a name="line.143"></a> +<span class="sourceLineNo">144</span><a name="line.144"></a> +<span class="sourceLineNo">145</span> if (nextTimestampObject == null) {<a name="line.145"></a> +<span class="sourceLineNo">146</span> // This should only happen if the current column's<a name="line.146"></a> +<span class="sourceLineNo">147</span> // timestamp is below the last one in the list.<a name="line.147"></a> +<span class="sourceLineNo">148</span> //<a name="line.148"></a> +<span class="sourceLineNo">149</span> // It should never happen as the filterCell should return NEXT_COL<a name="line.149"></a> +<span class="sourceLineNo">150</span> // but it's always better to be extra safe and protect against future<a name="line.150"></a> +<span class="sourceLineNo">151</span> // behavioral changes.<a name="line.151"></a> +<span class="sourceLineNo">152</span><a name="line.152"></a> +<span class="sourceLineNo">153</span> return CellUtil.createLastOnRowCol(currentCell);<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> // Since we know the nextTimestampObject isn't null here there must still be<a name="line.156"></a> +<span class="sourceLineNo">157</span> // timestamps that can be included. Cast the Long to a long and return the<a name="line.157"></a> +<span class="sourceLineNo">158</span> // a cell with the current row/cf/col and the next found timestamp.<a name="line.158"></a> +<span class="sourceLineNo">159</span> long nextTimestamp = nextTimestampObject;<a name="line.159"></a> +<span class="sourceLineNo">160</span> return CellUtil.createFirstOnRowColTS(currentCell, nextTimestamp);<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> public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {<a name="line.163"></a> +<span class="sourceLineNo">164</span> ArrayList<Long> timestamps = new ArrayList<>(filterArguments.size());<a name="line.164"></a> +<span class="sourceLineNo">165</span> for (int i = 0; i<filterArguments.size(); i++) {<a name="line.165"></a> +<span class="sourceLineNo">166</span> long timestamp = ParseFilter.convertByteArrayToLong(filterArguments.get(i));<a name="line.166"></a> +<span class="sourceLineNo">167</span> timestamps.add(timestamp);<a name="line.167"></a> +<span class="sourceLineNo">168</span> }<a name="line.168"></a> +<span class="sourceLineNo">169</span> return new TimestampsFilter(timestamps);<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> /**<a name="line.172"></a> +<span class="sourceLineNo">173</span> * @return The filter serialized using pb<a name="line.173"></a> +<span class="sourceLineNo">174</span> */<a name="line.174"></a> +<span class="sourceLineNo">175</span> public byte[] toByteArray() {<a name="line.175"></a> +<span class="sourceLineNo">176</span> FilterProtos.TimestampsFilter.Builder builder =<a name="line.176"></a> +<span class="sourceLineNo">177</span> FilterProtos.TimestampsFilter.newBuilder();<a name="line.177"></a> +<span class="sourceLineNo">178</span> builder.addAllTimestamps(this.timestamps);<a name="line.178"></a> +<span class="sourceLineNo">179</span> builder.setCanHint(canHint);<a name="line.179"></a> +<span class="sourceLineNo">180</span> return builder.build().toByteArray();<a name="line.180"></a> +<span class="sourceLineNo">181</span> }<a name="line.181"></a> +<span class="sourceLineNo">182</span><a name="line.182"></a> +<span class="sourceLineNo">183</span> /**<a name="line.183"></a> +<span class="sourceLineNo">184</span> * @param pbBytes A pb serialized {@link TimestampsFilter} instance<a name="line.184"></a> +<span class="sourceLineNo">185</span> *<a name="line.185"></a> +<span class="sourceLineNo">186</span> * @return An instance of {@link TimestampsFilter} made from <code>bytes</code><a name="line.186"></a> +<span class="sourceLineNo">187</span> * @see #toByteArray<a name="line.187"></a> +<span class="sourceLineNo">188</span> */<a name="line.188"></a> +<span class="sourceLineNo">189</span> public static TimestampsFilter parseFrom(final byte[] pbBytes)<a name="line.189"></a> +<span class="sourceLineNo">190</span> throws DeserializationException {<a name="line.190"></a> +<span class="sourceLineNo">191</span> FilterProtos.TimestampsFilter proto;<a name="line.191"></a> +<span class="sourceLineNo">192</span> try {<a name="line.192"></a> +<span class="sourceLineNo">193</span> proto = FilterProtos.TimestampsFilter.parseFrom(pbBytes);<a name="line.193"></a> +<span class="sourceLineNo">194</span> } catch (InvalidProtocolBufferException e) {<a name="line.194"></a> +<span class="sourceLineNo">195</span> throw new DeserializationException(e);<a name="line.195"></a> +<span class="sourceLineNo">196</span> }<a name="line.196"></a> +<span class="sourceLineNo">197</span> return new TimestampsFilter(proto.getTimestampsList(),<a name="line.197"></a> +<span class="sourceLineNo">198</span> proto.hasCanHint() && proto.getCanHint());<a name="line.198"></a> +<span class="sourceLineNo">199</span> }<a name="line.199"></a> +<span class="sourceLineNo">200</span><a name="line.200"></a> +<span class="sourceLineNo">201</span> /**<a name="line.201"></a> +<span class="sourceLineNo">202</span> * @param o the other filter to compare with<a name="line.202"></a> +<span class="sourceLineNo">203</span> * @return true if and only if the fields of the filter that are serialized<a name="line.203"></a> +<span class="sourceLineNo">204</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.204"></a> +<span class="sourceLineNo">205</span> */<a name="line.205"></a> +<span class="sourceLineNo">206</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.206"></a> +<span class="sourceLineNo">207</span> if (o == this) return true;<a name="line.207"></a> +<span class="sourceLineNo">208</span> if (!(o instanceof TimestampsFilter)) return false;<a name="line.208"></a> +<span class="sourceLineNo">209</span><a name="line.209"></a> +<span class="sourceLineNo">210</span> TimestampsFilter other = (TimestampsFilter)o;<a name="line.210"></a> +<span class="sourceLineNo">211</span> return this.getTimestamps().equals(other.getTimestamps());<a name="line.211"></a> +<span class="sourceLineNo">212</span> }<a name="line.212"></a> +<span class="sourceLineNo">213</span><a name="line.213"></a> +<span class="sourceLineNo">214</span> @Override<a name="line.214"></a> +<span class="sourceLineNo">215</span> public String toString() {<a name="line.215"></a> +<span class="sourceLineNo">216</span> return toString(MAX_LOG_TIMESTAMPS);<a name="line.216"></a> +<span class="sourceLineNo">217</span> }<a name="line.217"></a> +<span class="sourceLineNo">218</span><a name="line.218"></a> +<span class="sourceLineNo">219</span> protected String toString(int maxTimestamps) {<a name="line.219"></a> +<span class="sourceLineNo">220</span> StringBuilder tsList = new StringBuilder();<a name="line.220"></a> +<span class="sourceLineNo">221</span><a name="line.221"></a> +<span class="sourceLineNo">222</span> int count = 0;<a name="line.222"></a> +<span class="sourceLineNo">223</span> for (Long ts : this.timestamps) {<a name="line.223"></a> +<span class="sourceLineNo">224</span> if (count >= maxTimestamps) {<a name="line.224"></a> +<span class="sourceLineNo">225</span> break;<a name="line.225"></a> +<span class="sourceLineNo">226</span> }<a name="line.226"></a> +<span class="sourceLineNo">227</span> ++count;<a name="line.227"></a> +<span class="sourceLineNo">228</span> tsList.append(ts.toString());<a name="line.228"></a> +<span class="sourceLineNo">229</span> if (count < this.timestamps.size() && count < maxTimestamps) {<a name="line.229"></a> +<span class="sourceLineNo">230</span> tsList.append(", ");<a name="line.230"></a> +<span class="sourceLineNo">231</span> }<a name="line.231"></a> +<span class="sourceLineNo">232</span> }<a name="line.232"></a> +<span class="sourceLineNo">233</span><a name="line.233"></a> +<span class="sourceLineNo">234</span> return String.format("%s (%d/%d): [%s] canHint: [%b]", this.getClass().getSimpleName(),<a name="line.234"></a> +<span class="sourceLineNo">235</span> count, this.timestamps.size(), tsList.toString(), canHint);<a name="line.235"></a> +<span class="sourceLineNo">236</span> }<a name="line.236"></a> +<span class="sourceLineNo">237</span>}<a name="line.237"></a>
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/00c22388/apidocs/src-html/org/apache/hadoop/hbase/filter/ValueFilter.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/filter/ValueFilter.html b/apidocs/src-html/org/apache/hadoop/hbase/filter/ValueFilter.html index 0328b79..7492b39 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/filter/ValueFilter.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/filter/ValueFilter.html @@ -76,71 +76,77 @@ <span class="sourceLineNo">068</span> super(valueCompareOp, valueComparator);<a name="line.68"></a> <span class="sourceLineNo">069</span> }<a name="line.69"></a> <span class="sourceLineNo">070</span><a name="line.70"></a> -<span class="sourceLineNo">071</span> @Override<a name="line.71"></a> -<span class="sourceLineNo">072</span> public ReturnCode filterKeyValue(Cell v) {<a name="line.72"></a> -<span class="sourceLineNo">073</span> if (compareValue(getCompareOperator(), this.comparator, v)) {<a name="line.73"></a> -<span class="sourceLineNo">074</span> return ReturnCode.SKIP;<a name="line.74"></a> -<span class="sourceLineNo">075</span> }<a name="line.75"></a> -<span class="sourceLineNo">076</span> return ReturnCode.INCLUDE;<a name="line.76"></a> -<span class="sourceLineNo">077</span> }<a name="line.77"></a> -<span class="sourceLineNo">078</span><a name="line.78"></a> -<span class="sourceLineNo">079</span> public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {<a name="line.79"></a> -<span class="sourceLineNo">080</span> @SuppressWarnings("rawtypes") // for arguments<a name="line.80"></a> -<span class="sourceLineNo">081</span> ArrayList arguments = CompareFilter.extractArguments(filterArguments);<a name="line.81"></a> -<span class="sourceLineNo">082</span> CompareOperator compareOp = (CompareOperator)arguments.get(0);<a name="line.82"></a> -<span class="sourceLineNo">083</span> ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);<a name="line.83"></a> -<span class="sourceLineNo">084</span> return new ValueFilter(compareOp, comparator);<a name="line.84"></a> -<span class="sourceLineNo">085</span> }<a name="line.85"></a> -<span class="sourceLineNo">086</span><a name="line.86"></a> -<span class="sourceLineNo">087</span> /**<a name="line.87"></a> -<span class="sourceLineNo">088</span> * @return The filter serialized using pb<a name="line.88"></a> -<span class="sourceLineNo">089</span> */<a name="line.89"></a> -<span class="sourceLineNo">090</span> public byte [] toByteArray() {<a name="line.90"></a> -<span class="sourceLineNo">091</span> FilterProtos.ValueFilter.Builder builder =<a name="line.91"></a> -<span class="sourceLineNo">092</span> FilterProtos.ValueFilter.newBuilder();<a name="line.92"></a> -<span class="sourceLineNo">093</span> builder.setCompareFilter(super.convert());<a name="line.93"></a> -<span class="sourceLineNo">094</span> return builder.build().toByteArray();<a name="line.94"></a> -<span class="sourceLineNo">095</span> }<a name="line.95"></a> -<span class="sourceLineNo">096</span><a name="line.96"></a> -<span class="sourceLineNo">097</span> /**<a name="line.97"></a> -<span class="sourceLineNo">098</span> * @param pbBytes A pb serialized {@link ValueFilter} instance<a name="line.98"></a> -<span class="sourceLineNo">099</span> * @return An instance of {@link ValueFilter} made from <code>bytes</code><a name="line.99"></a> -<span class="sourceLineNo">100</span> * @throws DeserializationException<a name="line.100"></a> -<span class="sourceLineNo">101</span> * @see #toByteArray<a name="line.101"></a> -<span class="sourceLineNo">102</span> */<a name="line.102"></a> -<span class="sourceLineNo">103</span> public static ValueFilter parseFrom(final byte [] pbBytes)<a name="line.103"></a> -<span class="sourceLineNo">104</span> throws DeserializationException {<a name="line.104"></a> -<span class="sourceLineNo">105</span> FilterProtos.ValueFilter proto;<a name="line.105"></a> -<span class="sourceLineNo">106</span> try {<a name="line.106"></a> -<span class="sourceLineNo">107</span> proto = FilterProtos.ValueFilter.parseFrom(pbBytes);<a name="line.107"></a> -<span class="sourceLineNo">108</span> } catch (InvalidProtocolBufferException e) {<a name="line.108"></a> -<span class="sourceLineNo">109</span> throw new DeserializationException(e);<a name="line.109"></a> -<span class="sourceLineNo">110</span> }<a name="line.110"></a> -<span class="sourceLineNo">111</span> final CompareOperator valueCompareOp =<a name="line.111"></a> -<span class="sourceLineNo">112</span> CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());<a name="line.112"></a> -<span class="sourceLineNo">113</span> ByteArrayComparable valueComparator = null;<a name="line.113"></a> -<span class="sourceLineNo">114</span> try {<a name="line.114"></a> -<span class="sourceLineNo">115</span> if (proto.getCompareFilter().hasComparator()) {<a name="line.115"></a> -<span class="sourceLineNo">116</span> valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());<a name="line.116"></a> -<span class="sourceLineNo">117</span> }<a name="line.117"></a> -<span class="sourceLineNo">118</span> } catch (IOException ioe) {<a name="line.118"></a> -<span class="sourceLineNo">119</span> throw new DeserializationException(ioe);<a name="line.119"></a> -<span class="sourceLineNo">120</span> }<a name="line.120"></a> -<span class="sourceLineNo">121</span> return new ValueFilter(valueCompareOp,valueComparator);<a name="line.121"></a> -<span class="sourceLineNo">122</span> }<a name="line.122"></a> -<span class="sourceLineNo">123</span><a name="line.123"></a> -<span class="sourceLineNo">124</span> /**<a name="line.124"></a> -<span class="sourceLineNo">125</span><a name="line.125"></a> -<span class="sourceLineNo">126</span> * @return true if and only if the fields of the filter that are serialized<a name="line.126"></a> -<span class="sourceLineNo">127</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.127"></a> -<span class="sourceLineNo">128</span> */<a name="line.128"></a> -<span class="sourceLineNo">129</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.129"></a> -<span class="sourceLineNo">130</span> if (o == this) return true;<a name="line.130"></a> -<span class="sourceLineNo">131</span> if (!(o instanceof ValueFilter)) return false;<a name="line.131"></a> -<span class="sourceLineNo">132</span><a name="line.132"></a> -<span class="sourceLineNo">133</span> return super.areSerializedFieldsEqual(o);<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">071</span> @Deprecated<a name="line.71"></a> +<span class="sourceLineNo">072</span> @Override<a name="line.72"></a> +<span class="sourceLineNo">073</span> public ReturnCode filterKeyValue(final Cell c) {<a name="line.73"></a> +<span class="sourceLineNo">074</span> return filterCell(c);<a name="line.74"></a> +<span class="sourceLineNo">075</span> }<a name="line.75"></a> +<span class="sourceLineNo">076</span><a name="line.76"></a> +<span class="sourceLineNo">077</span> @Override<a name="line.77"></a> +<span class="sourceLineNo">078</span> public ReturnCode filterCell(final Cell c) {<a name="line.78"></a> +<span class="sourceLineNo">079</span> if (compareValue(getCompareOperator(), this.comparator, c)) {<a name="line.79"></a> +<span class="sourceLineNo">080</span> return ReturnCode.SKIP;<a name="line.80"></a> +<span class="sourceLineNo">081</span> }<a name="line.81"></a> +<span class="sourceLineNo">082</span> return ReturnCode.INCLUDE;<a name="line.82"></a> +<span class="sourceLineNo">083</span> }<a name="line.83"></a> +<span class="sourceLineNo">084</span><a name="line.84"></a> +<span class="sourceLineNo">085</span> public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {<a name="line.85"></a> +<span class="sourceLineNo">086</span> @SuppressWarnings("rawtypes") // for arguments<a name="line.86"></a> +<span class="sourceLineNo">087</span> ArrayList arguments = CompareFilter.extractArguments(filterArguments);<a name="line.87"></a> +<span class="sourceLineNo">088</span> CompareOperator compareOp = (CompareOperator)arguments.get(0);<a name="line.88"></a> +<span class="sourceLineNo">089</span> ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);<a name="line.89"></a> +<span class="sourceLineNo">090</span> return new ValueFilter(compareOp, comparator);<a name="line.90"></a> +<span class="sourceLineNo">091</span> }<a name="line.91"></a> +<span class="sourceLineNo">092</span><a name="line.92"></a> +<span class="sourceLineNo">093</span> /**<a name="line.93"></a> +<span class="sourceLineNo">094</span> * @return The filter serialized using pb<a name="line.94"></a> +<span class="sourceLineNo">095</span> */<a name="line.95"></a> +<span class="sourceLineNo">096</span> public byte [] toByteArray() {<a name="line.96"></a> +<span class="sourceLineNo">097</span> FilterProtos.ValueFilter.Builder builder =<a name="line.97"></a> +<span class="sourceLineNo">098</span> FilterProtos.ValueFilter.newBuilder();<a name="line.98"></a> +<span class="sourceLineNo">099</span> builder.setCompareFilter(super.convert());<a name="line.99"></a> +<span class="sourceLineNo">100</span> return builder.build().toByteArray();<a name="line.100"></a> +<span class="sourceLineNo">101</span> }<a name="line.101"></a> +<span class="sourceLineNo">102</span><a name="line.102"></a> +<span class="sourceLineNo">103</span> /**<a name="line.103"></a> +<span class="sourceLineNo">104</span> * @param pbBytes A pb serialized {@link ValueFilter} instance<a name="line.104"></a> +<span class="sourceLineNo">105</span> * @return An instance of {@link ValueFilter} made from <code>bytes</code><a name="line.105"></a> +<span class="sourceLineNo">106</span> * @throws DeserializationException<a name="line.106"></a> +<span class="sourceLineNo">107</span> * @see #toByteArray<a name="line.107"></a> +<span class="sourceLineNo">108</span> */<a name="line.108"></a> +<span class="sourceLineNo">109</span> public static ValueFilter parseFrom(final byte [] pbBytes)<a name="line.109"></a> +<span class="sourceLineNo">110</span> throws DeserializationException {<a name="line.110"></a> +<span class="sourceLineNo">111</span> FilterProtos.ValueFilter proto;<a name="line.111"></a> +<span class="sourceLineNo">112</span> try {<a name="line.112"></a> +<span class="sourceLineNo">113</span> proto = FilterProtos.ValueFilter.parseFrom(pbBytes);<a name="line.113"></a> +<span class="sourceLineNo">114</span> } catch (InvalidProtocolBufferException e) {<a name="line.114"></a> +<span class="sourceLineNo">115</span> throw new DeserializationException(e);<a name="line.115"></a> +<span class="sourceLineNo">116</span> }<a name="line.116"></a> +<span class="sourceLineNo">117</span> final CompareOperator valueCompareOp =<a name="line.117"></a> +<span class="sourceLineNo">118</span> CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());<a name="line.118"></a> +<span class="sourceLineNo">119</span> ByteArrayComparable valueComparator = null;<a name="line.119"></a> +<span class="sourceLineNo">120</span> try {<a name="line.120"></a> +<span class="sourceLineNo">121</span> if (proto.getCompareFilter().hasComparator()) {<a name="line.121"></a> +<span class="sourceLineNo">122</span> valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());<a name="line.122"></a> +<span class="sourceLineNo">123</span> }<a name="line.123"></a> +<span class="sourceLineNo">124</span> } catch (IOException ioe) {<a name="line.124"></a> +<span class="sourceLineNo">125</span> throw new DeserializationException(ioe);<a name="line.125"></a> +<span class="sourceLineNo">126</span> }<a name="line.126"></a> +<span class="sourceLineNo">127</span> return new ValueFilter(valueCompareOp,valueComparator);<a name="line.127"></a> +<span class="sourceLineNo">128</span> }<a name="line.128"></a> +<span class="sourceLineNo">129</span><a name="line.129"></a> +<span class="sourceLineNo">130</span> /**<a name="line.130"></a> +<span class="sourceLineNo">131</span><a name="line.131"></a> +<span class="sourceLineNo">132</span> * @return true if and only if the fields of the filter that are serialized<a name="line.132"></a> +<span class="sourceLineNo">133</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.133"></a> +<span class="sourceLineNo">134</span> */<a name="line.134"></a> +<span class="sourceLineNo">135</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.135"></a> +<span class="sourceLineNo">136</span> if (o == this) return true;<a name="line.136"></a> +<span class="sourceLineNo">137</span> if (!(o instanceof ValueFilter)) return false;<a name="line.137"></a> +<span class="sourceLineNo">138</span><a name="line.138"></a> +<span class="sourceLineNo">139</span> return super.areSerializedFieldsEqual(o);<a name="line.139"></a> +<span class="sourceLineNo">140</span> }<a name="line.140"></a> +<span class="sourceLineNo">141</span>}<a name="line.141"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/00c22388/apidocs/src-html/org/apache/hadoop/hbase/filter/WhileMatchFilter.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/filter/WhileMatchFilter.html b/apidocs/src-html/org/apache/hadoop/hbase/filter/WhileMatchFilter.html index 8a4ccbe..78f344c 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/filter/WhileMatchFilter.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/filter/WhileMatchFilter.html @@ -39,7 +39,7 @@ <span class="sourceLineNo">031</span>/**<a name="line.31"></a> <span class="sourceLineNo">032</span> * A wrapper filter that returns true from {@link #filterAllRemaining()} as soon<a name="line.32"></a> <span class="sourceLineNo">033</span> * as the wrapped filters {@link Filter#filterRowKey(byte[], int, int)},<a name="line.33"></a> -<span class="sourceLineNo">034</span> * {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)},<a name="line.34"></a> +<span class="sourceLineNo">034</span> * {@link Filter#filterCell(org.apache.hadoop.hbase.Cell)},<a name="line.34"></a> <span class="sourceLineNo">035</span> * {@link org.apache.hadoop.hbase.filter.Filter#filterRow()} or<a name="line.35"></a> <span class="sourceLineNo">036</span> * {@link org.apache.hadoop.hbase.filter.Filter#filterAllRemaining()} methods<a name="line.36"></a> <span class="sourceLineNo">037</span> * returns true.<a name="line.37"></a> @@ -85,83 +85,89 @@ <span class="sourceLineNo">077</span> return value;<a name="line.77"></a> <span class="sourceLineNo">078</span> }<a name="line.78"></a> <span class="sourceLineNo">079</span><a name="line.79"></a> -<span class="sourceLineNo">080</span> @Override<a name="line.80"></a> -<span class="sourceLineNo">081</span> public ReturnCode filterKeyValue(Cell v) throws IOException {<a name="line.81"></a> -<span class="sourceLineNo">082</span> ReturnCode c = filter.filterKeyValue(v);<a name="line.82"></a> -<span class="sourceLineNo">083</span> changeFAR(c != ReturnCode.INCLUDE);<a name="line.83"></a> -<span class="sourceLineNo">084</span> return c;<a name="line.84"></a> -<span class="sourceLineNo">085</span> }<a name="line.85"></a> -<span class="sourceLineNo">086</span><a name="line.86"></a> -<span class="sourceLineNo">087</span> @Override<a name="line.87"></a> -<span class="sourceLineNo">088</span> public Cell transformCell(Cell v) throws IOException {<a name="line.88"></a> -<span class="sourceLineNo">089</span> return filter.transformCell(v);<a name="line.89"></a> -<span class="sourceLineNo">090</span> }<a name="line.90"></a> -<span class="sourceLineNo">091</span><a name="line.91"></a> -<span class="sourceLineNo">092</span> @Override<a name="line.92"></a> -<span class="sourceLineNo">093</span> public boolean filterRow() throws IOException {<a name="line.93"></a> -<span class="sourceLineNo">094</span> boolean filterRow = this.filter.filterRow();<a name="line.94"></a> -<span class="sourceLineNo">095</span> changeFAR(filterRow);<a name="line.95"></a> -<span class="sourceLineNo">096</span> return filterRow;<a name="line.96"></a> -<span class="sourceLineNo">097</span> }<a name="line.97"></a> -<span class="sourceLineNo">098</span> <a name="line.98"></a> -<span class="sourceLineNo">099</span> @Override<a name="line.99"></a> -<span class="sourceLineNo">100</span> public boolean hasFilterRow() {<a name="line.100"></a> -<span class="sourceLineNo">101</span> return true;<a name="line.101"></a> -<span class="sourceLineNo">102</span> }<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> * @return The filter serialized using pb<a name="line.105"></a> -<span class="sourceLineNo">106</span> */<a name="line.106"></a> -<span class="sourceLineNo">107</span> public byte[] toByteArray() throws IOException {<a name="line.107"></a> -<span class="sourceLineNo">108</span> FilterProtos.WhileMatchFilter.Builder builder =<a name="line.108"></a> -<span class="sourceLineNo">109</span> FilterProtos.WhileMatchFilter.newBuilder();<a name="line.109"></a> -<span class="sourceLineNo">110</span> builder.setFilter(ProtobufUtil.toFilter(this.filter));<a name="line.110"></a> -<span class="sourceLineNo">111</span> return builder.build().toByteArray();<a name="line.111"></a> -<span class="sourceLineNo">112</span> }<a name="line.112"></a> -<span class="sourceLineNo">113</span><a name="line.113"></a> -<span class="sourceLineNo">114</span> /**<a name="line.114"></a> -<span class="sourceLineNo">115</span> * @param pbBytes A pb serialized {@link WhileMatchFilter} instance<a name="line.115"></a> -<span class="sourceLineNo">116</span> * @return An instance of {@link WhileMatchFilter} made from <code>bytes</code><a name="line.116"></a> -<span class="sourceLineNo">117</span> * @throws org.apache.hadoop.hbase.exceptions.DeserializationException<a name="line.117"></a> -<span class="sourceLineNo">118</span> * @see #toByteArray<a name="line.118"></a> -<span class="sourceLineNo">119</span> */<a name="line.119"></a> -<span class="sourceLineNo">120</span> public static WhileMatchFilter parseFrom(final byte [] pbBytes)<a name="line.120"></a> -<span class="sourceLineNo">121</span> throws DeserializationException {<a name="line.121"></a> -<span class="sourceLineNo">122</span> FilterProtos.WhileMatchFilter proto;<a name="line.122"></a> -<span class="sourceLineNo">123</span> try {<a name="line.123"></a> -<span class="sourceLineNo">124</span> proto = FilterProtos.WhileMatchFilter.parseFrom(pbBytes);<a name="line.124"></a> -<span class="sourceLineNo">125</span> } catch (InvalidProtocolBufferException e) {<a name="line.125"></a> -<span class="sourceLineNo">126</span> throw new DeserializationException(e);<a name="line.126"></a> -<span class="sourceLineNo">127</span> }<a name="line.127"></a> -<span class="sourceLineNo">128</span> try {<a name="line.128"></a> -<span class="sourceLineNo">129</span> return new WhileMatchFilter(ProtobufUtil.toFilter(proto.getFilter()));<a name="line.129"></a> -<span class="sourceLineNo">130</span> } catch (IOException ioe) {<a name="line.130"></a> -<span class="sourceLineNo">131</span> throw new DeserializationException(ioe);<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> /**<a name="line.135"></a> -<span class="sourceLineNo">136</span> * @param other<a name="line.136"></a> -<span class="sourceLineNo">137</span> * @return true if and only if the fields of the filter that are serialized<a name="line.137"></a> -<span class="sourceLineNo">138</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.138"></a> -<span class="sourceLineNo">139</span> */<a name="line.139"></a> -<span class="sourceLineNo">140</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.140"></a> -<span class="sourceLineNo">141</span> if (o == this) return true;<a name="line.141"></a> -<span class="sourceLineNo">142</span> if (!(o instanceof WhileMatchFilter)) return false;<a name="line.142"></a> -<span class="sourceLineNo">143</span><a name="line.143"></a> -<span class="sourceLineNo">144</span> WhileMatchFilter other = (WhileMatchFilter)o;<a name="line.144"></a> -<span class="sourceLineNo">145</span> return getFilter().areSerializedFieldsEqual(other.getFilter());<a name="line.145"></a> -<span class="sourceLineNo">146</span> }<a name="line.146"></a> -<span class="sourceLineNo">147</span><a name="line.147"></a> -<span class="sourceLineNo">148</span> public boolean isFamilyEssential(byte[] name) throws IOException {<a name="line.148"></a> -<span class="sourceLineNo">149</span> return filter.isFamilyEssential(name);<a name="line.149"></a> -<span class="sourceLineNo">150</span> }<a name="line.150"></a> -<span class="sourceLineNo">151</span><a name="line.151"></a> -<span class="sourceLineNo">152</span> @Override<a name="line.152"></a> -<span class="sourceLineNo">153</span> public String toString() {<a name="line.153"></a> -<span class="sourceLineNo">154</span> return this.getClass().getSimpleName() + " " + this.filter.toString();<a name="line.154"></a> -<span class="sourceLineNo">155</span> }<a name="line.155"></a> -<span class="sourceLineNo">156</span>}<a name="line.156"></a> +<span class="sourceLineNo">080</span> @Deprecated<a name="line.80"></a> +<span class="sourceLineNo">081</span> @Override<a name="line.81"></a> +<span class="sourceLineNo">082</span> public ReturnCode filterKeyValue(final Cell c) throws IOException {<a name="line.82"></a> +<span class="sourceLineNo">083</span> return filterCell(c);<a name="line.83"></a> +<span class="sourceLineNo">084</span> }<a name="line.84"></a> +<span class="sourceLineNo">085</span><a name="line.85"></a> +<span class="sourceLineNo">086</span> @Override<a name="line.86"></a> +<span class="sourceLineNo">087</span> public ReturnCode filterCell(final Cell c) throws IOException {<a name="line.87"></a> +<span class="sourceLineNo">088</span> ReturnCode code = filter.filterCell(c);<a name="line.88"></a> +<span class="sourceLineNo">089</span> changeFAR(code != ReturnCode.INCLUDE);<a name="line.89"></a> +<span class="sourceLineNo">090</span> return code;<a name="line.90"></a> +<span class="sourceLineNo">091</span> }<a name="line.91"></a> +<span class="sourceLineNo">092</span><a name="line.92"></a> +<span class="sourceLineNo">093</span> @Override<a name="line.93"></a> +<span class="sourceLineNo">094</span> public Cell transformCell(Cell v) throws IOException {<a name="line.94"></a> +<span class="sourceLineNo">095</span> return filter.transformCell(v);<a name="line.95"></a> +<span class="sourceLineNo">096</span> }<a name="line.96"></a> +<span class="sourceLineNo">097</span><a name="line.97"></a> +<span class="sourceLineNo">098</span> @Override<a name="line.98"></a> +<span class="sourceLineNo">099</span> public boolean filterRow() throws IOException {<a name="line.99"></a> +<span class="sourceLineNo">100</span> boolean filterRow = this.filter.filterRow();<a name="line.100"></a> +<span class="sourceLineNo">101</span> changeFAR(filterRow);<a name="line.101"></a> +<span class="sourceLineNo">102</span> return filterRow;<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> @Override<a name="line.105"></a> +<span class="sourceLineNo">106</span> public boolean hasFilterRow() {<a name="line.106"></a> +<span class="sourceLineNo">107</span> return true;<a name="line.107"></a> +<span class="sourceLineNo">108</span> }<a name="line.108"></a> +<span class="sourceLineNo">109</span><a name="line.109"></a> +<span class="sourceLineNo">110</span> /**<a name="line.110"></a> +<span class="sourceLineNo">111</span> * @return The filter serialized using pb<a name="line.111"></a> +<span class="sourceLineNo">112</span> */<a name="line.112"></a> +<span class="sourceLineNo">113</span> public byte[] toByteArray() throws IOException {<a name="line.113"></a> +<span class="sourceLineNo">114</span> FilterProtos.WhileMatchFilter.Builder builder =<a name="line.114"></a> +<span class="sourceLineNo">115</span> FilterProtos.WhileMatchFilter.newBuilder();<a name="line.115"></a> +<span class="sourceLineNo">116</span> builder.setFilter(ProtobufUtil.toFilter(this.filter));<a name="line.116"></a> +<span class="sourceLineNo">117</span> return builder.build().toByteArray();<a name="line.117"></a> +<span class="sourceLineNo">118</span> }<a name="line.118"></a> +<span class="sourceLineNo">119</span><a name="line.119"></a> +<span class="sourceLineNo">120</span> /**<a name="line.120"></a> +<span class="sourceLineNo">121</span> * @param pbBytes A pb serialized {@link WhileMatchFilter} instance<a name="line.121"></a> +<span class="sourceLineNo">122</span> * @return An instance of {@link WhileMatchFilter} made from <code>bytes</code><a name="line.122"></a> +<span class="sourceLineNo">123</span> * @throws org.apache.hadoop.hbase.exceptions.DeserializationException<a name="line.123"></a> +<span class="sourceLineNo">124</span> * @see #toByteArray<a name="line.124"></a> +<span class="sourceLineNo">125</span> */<a name="line.125"></a> +<span class="sourceLineNo">126</span> public static WhileMatchFilter parseFrom(final byte [] pbBytes)<a name="line.126"></a> +<span class="sourceLineNo">127</span> throws DeserializationException {<a name="line.127"></a> +<span class="sourceLineNo">128</span> FilterProtos.WhileMatchFilter proto;<a name="line.128"></a> +<span class="sourceLineNo">129</span> try {<a name="line.129"></a> +<span class="sourceLineNo">130</span> proto = FilterProtos.WhileMatchFilter.parseFrom(pbBytes);<a name="line.130"></a> +<span class="sourceLineNo">131</span> } catch (InvalidProtocolBufferException e) {<a name="line.131"></a> +<span class="sourceLineNo">132</span> throw new DeserializationException(e);<a name="line.132"></a> +<span class="sourceLineNo">133</span> }<a name="line.133"></a> +<span class="sourceLineNo">134</span> try {<a name="line.134"></a> +<span class="sourceLineNo">135</span> return new WhileMatchFilter(ProtobufUtil.toFilter(proto.getFilter()));<a name="line.135"></a> +<span class="sourceLineNo">136</span> } catch (IOException ioe) {<a name="line.136"></a> +<span class="sourceLineNo">137</span> throw new DeserializationException(ioe);<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><a name="line.140"></a> +<span class="sourceLineNo">141</span> /**<a name="line.141"></a> +<span class="sourceLineNo">142</span> * @param o the other filter to compare with<a name="line.142"></a> +<span class="sourceLineNo">143</span> * @return true if and only if the fields of the filter that are serialized<a name="line.143"></a> +<span class="sourceLineNo">144</span> * are equal to the corresponding fields in other. Used for testing.<a name="line.144"></a> +<span class="sourceLineNo">145</span> */<a name="line.145"></a> +<span class="sourceLineNo">146</span> boolean areSerializedFieldsEqual(Filter o) {<a name="line.146"></a> +<span class="sourceLineNo">147</span> if (o == this) return true;<a name="line.147"></a> +<span class="sourceLineNo">148</span> if (!(o instanceof WhileMatchFilter)) return false;<a name="line.148"></a> +<span class="sourceLineNo">149</span><a name="line.149"></a> +<span class="sourceLineNo">150</span> WhileMatchFilter other = (WhileMatchFilter)o;<a name="line.150"></a> +<span class="sourceLineNo">151</span> return getFilter().areSerializedFieldsEqual(other.getFilter());<a name="line.151"></a> +<span class="sourceLineNo">152</span> }<a name="line.152"></a> +<span class="sourceLineNo">153</span><a name="line.153"></a> +<span class="sourceLineNo">154</span> public boolean isFamilyEssential(byte[] name) throws IOException {<a name="line.154"></a> +<span class="sourceLineNo">155</span> return filter.isFamilyEssential(name);<a name="line.155"></a> +<span class="sourceLineNo">156</span> }<a name="line.156"></a> +<span class="sourceLineNo">157</span><a name="line.157"></a> +<span class="sourceLineNo">158</span> @Override<a name="line.158"></a> +<span class="sourceLineNo">159</span> public String toString() {<a name="line.159"></a> +<span class="sourceLineNo">160</span> return this.getClass().getSimpleName() + " " + this.filter.toString();<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> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/00c22388/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/Import.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/Import.html b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/Import.html index 2d3c05b..5a1f6a5 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/Import.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/mapreduce/Import.html @@ -490,16 +490,16 @@ <span class="sourceLineNo">482</span><a name="line.482"></a> <span class="sourceLineNo">483</span> /**<a name="line.483"></a> <span class="sourceLineNo">484</span> * Attempt to filter out the keyvalue<a name="line.484"></a> -<span class="sourceLineNo">485</span> * @param kv {@link KeyValue} on which to apply the filter<a name="line.485"></a> +<span class="sourceLineNo">485</span> * @param c {@link Cell} on which to apply the filter<a name="line.485"></a> <span class="sourceLineNo">486</span> * @return <tt>null</tt> if the key should not be written, otherwise returns the original<a name="line.486"></a> -<span class="sourceLineNo">487</span> * {@link KeyValue}<a name="line.487"></a> +<span class="sourceLineNo">487</span> * {@link Cell}<a name="line.487"></a> <span class="sourceLineNo">488</span> */<a name="line.488"></a> -<span class="sourceLineNo">489</span> public static Cell filterKv(Filter filter, Cell kv) throws IOException {<a name="line.489"></a> +<span class="sourceLineNo">489</span> public static Cell filterKv(Filter filter, Cell c) throws IOException {<a name="line.489"></a> <span class="sourceLineNo">490</span> // apply the filter and skip this kv if the filter doesn't apply<a name="line.490"></a> <span class="sourceLineNo">491</span> if (filter != null) {<a name="line.491"></a> -<span class="sourceLineNo">492</span> Filter.ReturnCode code = filter.filterKeyValue(kv);<a name="line.492"></a> +<span class="sourceLineNo">492</span> Filter.ReturnCode code = filter.filterCell(c);<a name="line.492"></a> <span class="sourceLineNo">493</span> if (LOG.isTraceEnabled()) {<a name="line.493"></a> -<span class="sourceLineNo">494</span> LOG.trace("Filter returned:" + code + " for the key value:" + kv);<a name="line.494"></a> +<span class="sourceLineNo">494</span> LOG.trace("Filter returned:" + code + " for the cell:" + c);<a name="line.494"></a> <span class="sourceLineNo">495</span> }<a name="line.495"></a> <span class="sourceLineNo">496</span> // if its not an accept type, then skip this kv<a name="line.496"></a> <span class="sourceLineNo">497</span> if (!(code.equals(Filter.ReturnCode.INCLUDE) || code<a name="line.497"></a> @@ -507,7 +507,7 @@ <span class="sourceLineNo">499</span> return null;<a name="line.499"></a> <span class="sourceLineNo">500</span> }<a name="line.500"></a> <span class="sourceLineNo">501</span> }<a name="line.501"></a> -<span class="sourceLineNo">502</span> return kv;<a name="line.502"></a> +<span class="sourceLineNo">502</span> return c;<a name="line.502"></a> <span class="sourceLineNo">503</span> }<a name="line.503"></a> <span class="sourceLineNo">504</span><a name="line.504"></a> <span class="sourceLineNo">505</span> // helper: create a new KeyValue based on CF rename map<a name="line.505"></a> @@ -691,7 +691,7 @@ <span class="sourceLineNo">683</span> System.err.println("By default Import will load data directly into HBase. To instead generate");<a name="line.683"></a> <span class="sourceLineNo">684</span> System.err.println("HFiles of data to prepare for a bulk data load, pass the option:");<a name="line.684"></a> <span class="sourceLineNo">685</span> System.err.println(" -D" + BULK_OUTPUT_CONF_KEY + "=/path/for/output");<a name="line.685"></a> -<span class="sourceLineNo">686</span> System.err.println("If there is a large result that includes too much KeyValue "<a name="line.686"></a> +<span class="sourceLineNo">686</span> System.err.println("If there is a large result that includes too much Cell "<a name="line.686"></a> <span class="sourceLineNo">687</span> + "whitch can occur OOME caused by the memery sort in reducer, pass the option:");<a name="line.687"></a> <span class="sourceLineNo">688</span> System.err.println(" -D" + HAS_LARGE_RESULT + "=true");<a name="line.688"></a> <span class="sourceLineNo">689</span> System.err<a name="line.689"></a> @@ -702,9 +702,9 @@ <span class="sourceLineNo">694</span> + CF_RENAME_PROP + " property. Futher, filters will only use the"<a name="line.694"></a> <span class="sourceLineNo">695</span> + " Filter#filterRowKey(byte[] buffer, int offset, int length) method to identify "<a name="line.695"></a> <span class="sourceLineNo">696</span> + " whether the current row needs to be ignored completely for processing and "<a name="line.696"></a> -<span class="sourceLineNo">697</span> + " Filter#filterKeyValue(KeyValue) method to determine if the KeyValue should be added;"<a name="line.697"></a> +<span class="sourceLineNo">697</span> + " Filter#filterCell(Cell) method to determine if the Cell should be added;"<a name="line.697"></a> <span class="sourceLineNo">698</span> + " Filter.ReturnCode#INCLUDE and #INCLUDE_AND_NEXT_COL will be considered as including"<a name="line.698"></a> -<span class="sourceLineNo">699</span> + " the KeyValue.");<a name="line.699"></a> +<span class="sourceLineNo">699</span> + " the Cell.");<a name="line.699"></a> <span class="sourceLineNo">700</span> System.err.println("To import data exported from HBase 0.94, use");<a name="line.700"></a> <span class="sourceLineNo">701</span> System.err.println(" -Dhbase.import.version=0.94");<a name="line.701"></a> <span class="sourceLineNo">702</span> System.err.println(" -D " + JOB_NAME_CONF_KEY<a name="line.702"></a>