HBASE-16145 MultiRowRangeFilter constructor shouldn't throw IOException (Konstantin Ryakhovskiy)

This commit is contained in:
tedyu 2016-10-17 16:06:10 -07:00
parent 0c304a049b
commit 10840a51e8
3 changed files with 4 additions and 21 deletions

View File

@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -64,11 +63,8 @@ public class MultiRowRangeFilter extends FilterBase {
/**
* @param list A list of <code>RowRange</code>
* @throws java.io.IOException
* throw an exception if the range list is not in an natural order or any
* <code>RowRange</code> is invalid
*/
public MultiRowRangeFilter(List<RowRange> list) throws IOException {
public MultiRowRangeFilter(List<RowRange> list) {
this.rangeList = sortAndMerge(list);
}
@ -184,11 +180,7 @@ public class MultiRowRangeFilter extends FilterBase {
rangeProto.getStopRow().toByteArray() : null, rangeProto.getStopRowInclusive());
rangeList.add(range);
}
try {
return new MultiRowRangeFilter(rangeList);
} catch (IOException e) {
throw new DeserializationException("Fail to instantiate the MultiRowRangeFilter", e);
}
return new MultiRowRangeFilter(rangeList);
}
/**

View File

@ -407,11 +407,7 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
filter = new MultipleColumnPrefixFilter(values);
} break;
case MultiRowRangeFilter: {
try {
filter = new MultiRowRangeFilter(ranges);
} catch (IOException e) {
throw new RuntimeException(e);
}
filter = new MultiRowRangeFilter(ranges);
} break;
case PageFilter:
filter = new PageFilter(Long.parseLong(value));

View File

@ -207,12 +207,7 @@ public class RowCounter extends Configured implements Tool {
scan.setStartRow(range.getStartRow()); //inclusive
scan.setStopRow(range.getStopRow()); //exclusive
} else if (size > 1) {
try {
scan.setFilter(new MultiRowRangeFilter(rowRangeList));
} catch (IOException e) {
//the IOException should never be thrown. see HBASE-16145
throw new RuntimeException("Cannot instantiate MultiRowRangeFilter");
}
scan.setFilter(new MultiRowRangeFilter(rowRangeList));
}
}