Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
  2. index ce5a44c..e5c0713 100644
  3. --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
  4. +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
  5. @@ -37,6 +37,7 @@ import org.apache.commons.logging.Log;
  6. import org.apache.commons.logging.LogFactory;
  7. import org.apache.hadoop.conf.Configuration;
  8. import org.apache.hadoop.hbase.Cell;
  9. +import org.apache.hadoop.hbase.HColumnDescriptor;
  10. import org.apache.hadoop.hbase.HConstants;
  11. import org.apache.hadoop.hbase.HRegionLocation;
  12. import org.apache.hadoop.hbase.HTableDescriptor;
  13. @@ -71,6 +72,7 @@ import com.google.protobuf.Descriptors;
  14. import com.google.protobuf.Message;
  15. import com.google.protobuf.Service;
  16. import com.google.protobuf.ServiceException;
  17. +import com.sun.org.apache.bcel.internal.generic.GETFIELD;
  18.  
  19. /**
  20. * An implementation of {@link Table}. Used to communicate with a single HBase table.
  21. @@ -341,6 +343,19 @@ public class HTable implements HTableInterface {
  22. if (scan.getBatch() > 0 && scan.isSmall()) {
  23. throw new IllegalArgumentException("Small scan should not be used with batching");
  24. }
  25. + if (scan.hasFilter()) {
  26. + boolean useEssential = false;
  27. + for (HColumnDescriptor family : getTableDescriptor().getColumnFamilies()) {
  28. + if (scan.getFilter().isFamilyEssential(family.getName())) {
  29. + useEssential = true;
  30. + break;
  31. + }
  32. + }
  33. + if (useEssential && scan.getAllowPartialResults()) {
  34. + throw new IllegalArgumentException(
  35. + "Essential column family filter and partial Scan cannot be used together: data loss");
  36. + }
  37. + }
  38.  
  39. if (scan.getCaching() <= 0) {
  40. scan.setCaching(scannerCaching);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement