Class Query

All Implemented Interfaces:
Attributes
Direct Known Subclasses:
Get, Scan

@Public public abstract class Query extends OperationWithAttributes
Base class for HBase read operations; e.g. Scan and Get.
  • Field Details

  • Constructor Details

  • Method Details

    • getFilter

      public Filter getFilter()
    • setFilter

      public Query setFilter(Filter filter)
      Apply the specified server-side filter when performing the Query. Only Filter.filterCell(org.apache.hadoop.hbase.Cell) is called AFTER all tests for ttl, column match, deletes and column family's max versions have been run.
      Parameters:
      filter - filter to run on the server
      Returns:
      this for invocation chaining
    • setAuthorizations

      public Query setAuthorizations(Authorizations authorizations)
      Sets the authorizations to be used by this Query
    • getAuthorizations

      Returns The authorizations this Query is associated with. n
      Throws:
      DeserializationException
    • getACL

      public byte[] getACL()
      Returns The serialized ACL for this operation, or null if none
    • setACL

      public Query setACL(String user, Permission perms)
      Set the ACL for the operation.
      Parameters:
      user - User short name
      perms - Permissions for the user
    • setACL

      public Query setACL(Map<String,Permission> perms)
      Set the ACL for the operation.
      Parameters:
      perms - A map of permissions for a user or users
    • getConsistency

      Returns the consistency level for this operation
      Returns:
      the consistency level
    • setConsistency

      public Query setConsistency(Consistency consistency)
      Sets the consistency level for this operation
      Parameters:
      consistency - the consistency level
    • setReplicaId

      public Query setReplicaId(int Id)
      Specify region replica id where Query will fetch data from. Use this together with setConsistency(Consistency) passing Consistency.TIMELINE to read data from a specific replicaId.
      Expert: This is an advanced API exposed. Only use it if you know what you are doing
    • getReplicaId

      public int getReplicaId()
      Returns region replica id where Query will fetch data from.
      Returns:
      region replica id or -1 if not set.
    • setIsolationLevel

      Set the isolation level for this query. If the isolation level is set to READ_UNCOMMITTED, then this query will return data from committed and uncommitted transactions. If the isolation level is set to READ_COMMITTED, then this query will return data from committed transactions only. If a isolation level is not explicitly set on a Query, then it is assumed to be READ_COMMITTED.
      Parameters:
      level - IsolationLevel for this query
    • getIsolationLevel

      Returns The isolation level of this query. If no isolation level was set for this query object, then it returns READ_COMMITTED.
    • setLoadColumnFamiliesOnDemand

      public Query setLoadColumnFamiliesOnDemand(boolean value)
      Set the value indicating whether loading CFs on demand should be allowed (cluster default is false). On-demand CF loading doesn't load column families until necessary, e.g. if you filter on one column, the other column family data will be loaded only for the rows that are included in result, not all rows like in normal case. With column-specific filters, like SingleColumnValueFilter w/filterIfMissing == true, this can deliver huge perf gains when there's a cf with lots of data; however, it can also lead to some inconsistent results, as follows: - if someone does a concurrent update to both column families in question you may get a row that never existed, e.g. for { rowKey = 5, { cat_videos => 1 }, { video => "my cat" } } someone puts rowKey 5 with { cat_videos => 0 }, { video => "my dog" }, concurrent scan filtering on "cat_videos == 1" can get { rowKey = 5, { cat_videos => 1 }, { video => "my dog" } }. - if there's a concurrent split and you have more than 2 column families, some rows may be missing some column families.
    • getLoadColumnFamiliesOnDemandValue

      Get the raw loadColumnFamiliesOnDemand setting; if it's not set, can be null.
    • doLoadColumnFamiliesOnDemand

      public boolean doLoadColumnFamiliesOnDemand()
      Get the logical value indicating whether on-demand CF loading should be allowed.
    • setColumnFamilyTimeRange

      public Query setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp)
      Get versions of columns only within the specified timestamp range, [minStamp, maxStamp) on a per CF bases. Note, default maximum versions to return is 1. If your time range spans more than one version and you want all versions returned, up the number of versions beyond the default. Column Family time ranges take precedence over the global time range.
      Parameters:
      cf - the column family for which you want to restrict
      minStamp - minimum timestamp value, inclusive
      maxStamp - maximum timestamp value, exclusive
    • getColumnFamilyTimeRange

      Returns A map of column families to time ranges