Java Code Examples for org.apache.hadoop.hbase.filter.SingleColumnValueFilter#setFilterIfMissing()

The following examples show how to use org.apache.hadoop.hbase.filter.SingleColumnValueFilter#setFilterIfMissing() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FromClientSideBase.java    From hbase with Apache License 2.0 6 votes vote down vote up
protected ResultScanner buildScanner(String keyPrefix, String value, Table ht)
  throws IOException {
  // OurFilterList allFilters = new OurFilterList();
  FilterList allFilters = new FilterList(/* FilterList.Operator.MUST_PASS_ALL */);
  allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix)));
  SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes
    .toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOperator.EQUAL, Bytes
    .toBytes(value));
  filter.setFilterIfMissing(true);
  allFilters.addFilter(filter);

  // allFilters.addFilter(new
  // RowExcludingSingleColumnValueFilter(Bytes.toBytes("trans-tags"),
  // Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes.toBytes(value)));

  Scan scan = new Scan();
  scan.addFamily(Bytes.toBytes("trans-blob"));
  scan.addFamily(Bytes.toBytes("trans-type"));
  scan.addFamily(Bytes.toBytes("trans-date"));
  scan.addFamily(Bytes.toBytes("trans-tags"));
  scan.addFamily(Bytes.toBytes("trans-group"));
  scan.setFilter(allFilters);

  return ht.getScanner(scan);
}
 
Example 2
Source File: TestJoinedScanners.java    From hbase with Apache License 2.0 6 votes vote down vote up
private void runScanner(Table table, boolean slow) throws Exception {
  long time = System.nanoTime();
  Scan scan = new Scan();
  scan.addColumn(cf_essential, col_name);
  scan.addColumn(cf_joined, col_name);

  SingleColumnValueFilter filter = new SingleColumnValueFilter(
      cf_essential, col_name, CompareOperator.EQUAL, flag_yes);
  filter.setFilterIfMissing(true);
  scan.setFilter(filter);
  scan.setLoadColumnFamiliesOnDemand(!slow);

  ResultScanner result_scanner = table.getScanner(scan);
  Result res;
  long rows_count = 0;
  while ((res = result_scanner.next()) != null) {
    rows_count++;
  }

  double timeSec = (System.nanoTime() - time) / 1000000000.0;
  result_scanner.close();
  LOG.info((slow ? "Slow" : "Joined") + " scanner finished in " + Double.toString(timeSec)
    + " seconds, got " + Long.toString(rows_count/2) + " rows");
}
 
Example 3
Source File: ViewUtil.java    From phoenix with Apache License 2.0 6 votes vote down vote up
/**
 * Check metadata to find all child views for a given table/view
 * @param sysCatOrsysChildLink For older (pre-4.15.0) clients, we look for child links inside SYSTEM.CATALOG,
 *                             otherwise we look for them inside SYSTEM.CHILD_LINK
 * @param tenantId tenantId
 * @param schemaName table schema name
 * @param tableName table name
 * @param timestamp passed client-side timestamp
 * @return true if the given table has at least one child view
 * @throws IOException
 */
public static boolean hasChildViews(Table sysCatOrsysChildLink, byte[] tenantId, byte[] schemaName,
                                    byte[] tableName, long timestamp) throws IOException {
    byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
    Scan scan = MetaDataUtil.newTableRowsScan(key, MetaDataProtocol.MIN_TABLE_TIMESTAMP, timestamp);
    SingleColumnValueFilter linkFilter =
            new SingleColumnValueFilter(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES,
                    CompareFilter.CompareOp.EQUAL,
                    LinkType.CHILD_TABLE.getSerializedValueAsByteArray()) {
                // if we found a row with the CHILD_TABLE link type we are done and can
                // terminate the scan
                @Override
                public boolean filterAllRemaining() {
                    return matchedColumn;
                }
            };
    linkFilter.setFilterIfMissing(true);
    scan.setFilter(linkFilter);
    scan.addColumn(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES);
    try (ResultScanner scanner = sysCatOrsysChildLink.getScanner(scan)) {
        Result result = scanner.next();
        return result!=null; 
    }
}
 
Example 4
Source File: HbaseServiceImpl.java    From searchanalytics-bigdata with MIT License 6 votes vote down vote up
@Override
public List<String> getSearchClicksRowKeysWithValidQueryString() {
	LOG.debug("Checking getSearchClicksRowKeys searchclicks table content!");
	Scan scan = new Scan();
	scan.addFamily(HbaseJsonEventSerializer.COLUMFAMILY_SEARCH_BYTES);
	SingleColumnValueFilter filter = new SingleColumnValueFilter(HbaseJsonEventSerializer.COLUMFAMILY_SEARCH_BYTES, 
			Bytes.toBytes("querystring"), CompareOp.NOT_EQUAL, Bytes.toBytes("jaiblahblah"));
	filter.setFilterIfMissing(true);
	scan.setFilter(filter);
	List<String> rows = hbaseTemplate.find("searchclicks", scan,
			new RowMapper<String>() {
				@Override
				public String mapRow(Result result, int rowNum)
						throws Exception {
					return new String(result.getRow());
				}
			});
	for (String row : rows) {
		LOG.debug("searchclicks table content, Table returned row key: {}", row);
	}
	LOG.debug("Checking getSearchClicksRowKeys searchclicks table content done!");
	return rows;
}
 
Example 5
Source File: AclService.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Override
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) {
    List<ObjectIdentity> oids = new ArrayList<ObjectIdentity>();
    HTableInterface htable = null;
    try {
        htable = HBaseConnection.get(hbaseUrl).getTable(aclTableName);

        Scan scan = new Scan();
        SingleColumnValueFilter parentFilter = new SingleColumnValueFilter(Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN), CompareOp.EQUAL, domainObjSerializer.serialize(new DomainObjectInfo(parentIdentity)));
        parentFilter.setFilterIfMissing(true);
        scan.setFilter(parentFilter);

        ResultScanner scanner = htable.getScanner(scan);
        for (Result result = scanner.next(); result != null; result = scanner.next()) {
            String id = Bytes.toString(result.getRow());
            String type = Bytes.toString(result.getValue(Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_TYPE_COLUMN)));

            oids.add(new ObjectIdentityImpl(type, id));
        }
    } catch (IOException e) {
        throw new RuntimeException(e.getMessage(), e);
    } finally {
        IOUtils.closeQuietly(htable);
    }

    return oids;
}
 
Example 6
Source File: TestHBaseActionModifiable.java    From kite with Apache License 2.0 5 votes vote down vote up
private ScanModifier newScanModifier(final String value) {
  return new ScanModifier() {
    @Override
    public Scan modifyScan(Scan scan) {
      scan.addColumn(Bytes.toBytes("meta"), Bytes.toBytes("testcf"));
      SingleColumnValueFilter filter = new SingleColumnValueFilter(
          Bytes.toBytes("meta"), Bytes.toBytes("testcf"),
          CompareFilter.CompareOp.EQUAL, Bytes.toBytes(value));
      filter.setFilterIfMissing(true);
      scan.setFilter(filter);
      return scan;
    }
  };
}
 
Example 7
Source File: EntityScannerBuilder.java    From kite with Apache License 2.0 5 votes vote down vote up
/**
 * Only include rows which are missing this field, this was the only possible
 * way to do it.
 * 
 * @param fieldName
 *          The field which should be missing
 * @return ScannerBuilder
 */
public EntityScannerBuilder<E> addIsMissingFilter(String fieldName) {
  SingleFieldEntityFilter singleFieldEntityFilter = new SingleFieldEntityFilter(
      entityMapper.getEntitySchema(), entityMapper.getEntitySerDe(),
      fieldName, "++++NON_SHALL_PASS++++", CompareFilter.CompareOp.EQUAL);
  SingleColumnValueFilter filter = (SingleColumnValueFilter) singleFieldEntityFilter
      .getFilter();
  filter.setFilterIfMissing(false);
  filterList.add(filter);
  return this;
}
 
Example 8
Source File: MetaDataEndpointImpl.java    From phoenix with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @param tableName parent table's name
 * @return true if there exist a table that use this table as their base table.
 * TODO: should we pass a timestamp here?
 */
private boolean hasViews(HRegion region, byte[] tenantId, PTable table) throws IOException {
    byte[] schemaName = table.getSchemaName().getBytes();
    byte[] tableName = table.getTableName().getBytes();
    Scan scan = new Scan();
    // If the table is multi-tenant, we need to check across all tenant_ids,
    // so we can't constrain the row key. Otherwise, any views would have
    // the same tenantId.
    if (!table.isMultiTenant()) {
        byte[] startRow = ByteUtil.concat(tenantId, QueryConstants.SEPARATOR_BYTE_ARRAY);
        byte[] stopRow = ByteUtil.nextKey(startRow);
        scan.setStartRow(startRow);
        scan.setStopRow(stopRow);
    }
    SingleColumnValueFilter filter1 = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, BASE_SCHEMA_NAME_BYTES, EQUAL, schemaName);
    filter1.setFilterIfMissing(schemaName.length > 0);
    SingleColumnValueFilter filter2 = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, BASE_TABLE_NAME_BYTES, EQUAL, tableName);
    filter2.setFilterIfMissing(true);
    BinaryComparator comparator = new BinaryComparator(ByteUtil.concat(tenantId, QueryConstants.SEPARATOR_BYTE_ARRAY, schemaName, QueryConstants.SEPARATOR_BYTE_ARRAY, tableName));
    RowFilter filter3 = new RowFilter(CompareOp.NOT_EQUAL,comparator);
    Filter filter = new FilterList(filter1,filter2,filter3);
    scan.setFilter(filter);
    RegionScanner scanner = region.getScanner(scan);
    try {
        List<KeyValue> results = newArrayList();
        scanner.next(results);
        return results.size() > 0;
    }
    finally {
        scanner.close();
    }
}
 
Example 9
Source File: PhoenixRuntimeIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private static Filter getUserTableAndViewsFilter() {
    SingleColumnValueFilter tableFilter = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.TABLE_TYPE_BYTES, CompareOp.EQUAL, Bytes.toBytes(PTableType.TABLE.getSerializedValue()));
    tableFilter.setFilterIfMissing(true);
    SingleColumnValueFilter viewFilter = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.TABLE_TYPE_BYTES, CompareOp.EQUAL, Bytes.toBytes(PTableType.VIEW.getSerializedValue()));
    viewFilter.setFilterIfMissing(true);
    FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ONE, Arrays.asList(new Filter[] {tableFilter, viewFilter}));
    return filter;
}
 
Example 10
Source File: ElementModel.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
protected Scan getPropertyScan(String label) {
    Scan scan = new Scan();
    SingleColumnValueFilter valueFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            Constants.LABEL_BYTES, CompareFilter.CompareOp.EQUAL, new BinaryComparator(ValueUtils.serialize(label)));
    valueFilter.setFilterIfMissing(true);
    scan.setFilter(valueFilter);
    return scan;
}
 
Example 11
Source File: TestJoinedScanners.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test(expected = DoNotRetryIOException.class)
public void testWithReverseScan() throws Exception {
  try (Connection con = TEST_UTIL.getConnection(); Admin admin = con.getAdmin()) {
    TableName tableName = TableName.valueOf(name.getMethodName());

    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(tableName)
        .setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf1"))
        .setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf2"))
        .build();
    admin.createTable(tableDescriptor);

    try (Table table = con.getTable(tableName)) {
      SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes("cf1"),
        Bytes.toBytes("col"), CompareOperator.EQUAL, Bytes.toBytes("val"));
      filter.setFilterIfMissing(true);

      // Reverse scan with loading CFs on demand
      Scan scan = new Scan();
      scan.setFilter(filter);
      scan.setReversed(true);
      scan.setLoadColumnFamiliesOnDemand(true);

      try (ResultScanner scanner = table.getScanner(scan)) {
        // DoNotRetryIOException should occur
        scanner.next();
      }
    }
  }
}
 
Example 12
Source File: PhoenixRuntimeIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private static Filter getUserTableAndViewsFilter() {
    SingleColumnValueFilter tableFilter = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.TABLE_TYPE_BYTES, CompareOp.EQUAL, Bytes.toBytes(PTableType.TABLE.getSerializedValue()));
    tableFilter.setFilterIfMissing(true);
    SingleColumnValueFilter viewFilter = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.TABLE_TYPE_BYTES, CompareOp.EQUAL, Bytes.toBytes(PTableType.VIEW.getSerializedValue()));
    viewFilter.setFilterIfMissing(true);
    FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ONE, Arrays.asList(new Filter[] {tableFilter, viewFilter}));
    return filter;
}
 
Example 13
Source File: ElementModel.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
protected Scan getPropertyScan(String label, byte[] key, byte[] inclusiveFromValue, byte[] exclusiveToValue) {
    Scan scan = new Scan();
    SingleColumnValueFilter labelFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            Constants.LABEL_BYTES, CompareFilter.CompareOp.EQUAL, new BinaryComparator(ValueUtils.serialize(label)));
    labelFilter.setFilterIfMissing(true);
    SingleColumnValueFilter fromValueFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            key, CompareFilter.CompareOp.GREATER_OR_EQUAL, new BinaryComparator(inclusiveFromValue));
    fromValueFilter.setFilterIfMissing(true);
    SingleColumnValueFilter toValueFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            key, CompareFilter.CompareOp.LESS, new BinaryComparator(exclusiveToValue));
    toValueFilter.setFilterIfMissing(true);
    FilterList filterList = new FilterList(labelFilter, fromValueFilter, toValueFilter);
    scan.setFilter(filterList);
    return scan;
}
 
Example 14
Source File: ElementModel.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
protected Scan getPropertyScan(String label, byte[] key, byte[] val) {
    Scan scan = new Scan();
    SingleColumnValueFilter labelFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            Constants.LABEL_BYTES, CompareFilter.CompareOp.EQUAL, new BinaryComparator(ValueUtils.serialize(label)));
    labelFilter.setFilterIfMissing(true);
    SingleColumnValueFilter valueFilter = new SingleColumnValueFilter(Constants.DEFAULT_FAMILY_BYTES,
            key, CompareFilter.CompareOp.EQUAL, new BinaryComparator(val));
    valueFilter.setFilterIfMissing(true);
    FilterList filterList = new FilterList(labelFilter, valueFilter);
    scan.setFilter(filterList);
    return scan;
}
 
Example 15
Source File: IntegrationTestLazyCfLoading.java    From hbase with Apache License 2.0 4 votes vote down vote up
public Filter getScanFilter() {
  SingleColumnValueFilter scf = new SingleColumnValueFilter(ESSENTIAL_CF, FILTER_COLUMN,
      CompareOperator.EQUAL, Bytes.toBytes(ACCEPTED_VALUE));
  scf.setFilterIfMissing(true);
  return scf;
}
 
Example 16
Source File: ViewUtil.java    From phoenix with Apache License 2.0 4 votes vote down vote up
/**
   * Runs a scan on SYSTEM.CATALOG or SYSTEM.CHILD_LINK to get the related tables/views
   */
  private static TableViewFinderResult findRelatedViews(Table sysCatOrsysChildLink, byte[] tenantId, byte[] schema, byte[] table,
      PTable.LinkType linkType, long timestamp) throws IOException {
      if (linkType==PTable.LinkType.INDEX_TABLE || linkType==PTable.LinkType.EXCLUDED_COLUMN) {
          throw new IllegalArgumentException("findAllRelatives does not support link type "+linkType);
      }
      byte[] key = SchemaUtil.getTableKey(tenantId, schema, table);
Scan scan = MetaDataUtil.newTableRowsScan(key, MetaDataProtocol.MIN_TABLE_TIMESTAMP, timestamp);
      SingleColumnValueFilter linkFilter =
          new SingleColumnValueFilter(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES, CompareFilter.CompareOp.EQUAL,
              linkType.getSerializedValueAsByteArray());
      linkFilter.setFilterIfMissing(true);
      scan.setFilter(linkFilter);
      scan.addColumn(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES);
      if (linkType==PTable.LinkType.PARENT_TABLE)
          scan.addColumn(TABLE_FAMILY_BYTES, PARENT_TENANT_ID_BYTES);
      if (linkType==PTable.LinkType.PHYSICAL_TABLE)
          scan.addColumn(TABLE_FAMILY_BYTES, TABLE_TYPE_BYTES);
      List<TableInfo> tableInfoList = Lists.newArrayList();
      try (ResultScanner scanner = sysCatOrsysChildLink.getScanner(scan))  {
          for (Result result = scanner.next(); (result != null); result = scanner.next()) {
              byte[][] rowKeyMetaData = new byte[5][];
              byte[] viewTenantId = null;
              getVarChars(result.getRow(), 5, rowKeyMetaData);
              if (linkType==PTable.LinkType.PARENT_TABLE) {
                  viewTenantId = result.getValue(TABLE_FAMILY_BYTES, PARENT_TENANT_ID_BYTES);
              } else if (linkType==PTable.LinkType.CHILD_TABLE) {
                  viewTenantId = rowKeyMetaData[PhoenixDatabaseMetaData.COLUMN_NAME_INDEX];
              } else if (linkType==PTable.LinkType.VIEW_INDEX_PARENT_TABLE) {
                  viewTenantId = rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
              } 
              else if (linkType==PTable.LinkType.PHYSICAL_TABLE && result.getValue(TABLE_FAMILY_BYTES, TABLE_TYPE_BYTES)!=null) {
                  // do not links from indexes to their physical table
                  continue;
              }
              byte[] viewSchemaName = SchemaUtil.getSchemaNameFromFullName(rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX]).getBytes();
              byte[] viewName = SchemaUtil.getTableNameFromFullName(rowKeyMetaData[PhoenixDatabaseMetaData.FAMILY_NAME_INDEX]).getBytes();
              tableInfoList.add(new TableInfo(viewTenantId, viewSchemaName, viewName));
          }
          return new TableViewFinderResult(tableInfoList);
      } 
  }
 
Example 17
Source File: MetaDataEndpointImpl.java    From phoenix with Apache License 2.0 4 votes vote down vote up
/**
 * @param tableName parent table's name
 * Looks for whether child views exist for the table specified by table.
 * TODO: should we pass a timestamp here?
 */
private TableViewFinderResult findChildViews(HRegion region, byte[] tenantId, PTable table) throws IOException {
    byte[] schemaName = table.getSchemaName().getBytes();
    byte[] tableName = table.getTableName().getBytes();
    boolean isMultiTenant = table.isMultiTenant();
    Scan scan = new Scan();
    // If the table is multi-tenant, we need to check across all tenant_ids,
    // so we can't constrain the row key. Otherwise, any views would have
    // the same tenantId.
    if (!isMultiTenant) {
        byte[] startRow = ByteUtil.concat(tenantId, QueryConstants.SEPARATOR_BYTE_ARRAY);
        byte[] stopRow = ByteUtil.nextKey(startRow);
        scan.setStartRow(startRow);
        scan.setStopRow(stopRow);
    }
    SingleColumnValueFilter linkFilter = new SingleColumnValueFilter(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES, CompareOp.EQUAL, PHYSICAL_TABLE_BYTES);
    linkFilter.setFilterIfMissing(true);
    byte[] suffix = ByteUtil.concat(QueryConstants.SEPARATOR_BYTE_ARRAY, SchemaUtil.getTableNameAsBytes(schemaName, tableName));
    SuffixFilter rowFilter = new SuffixFilter(suffix);
    Filter filter = new FilterList(linkFilter, rowFilter);
    scan.setFilter(filter);
    scan.addColumn(TABLE_FAMILY_BYTES, LINK_TYPE_BYTES);
    // Original region-only scanner modified due to PHOENIX-1208
    // RegionScanner scanner = region.getScanner(scan);
    // The following *should* work, but doesn't due to HBASE-11837
    // TableName systemCatalogTableName = region.getTableDesc().getTableName();
    // HTableInterface hTable = env.getTable(systemCatalogTableName);
    // These deprecated calls work around the issue
    HTableInterface hTable = ServerUtil.getHTableForCoprocessorScan(env, PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
    try {
        boolean allViewsInCurrentRegion = true;
        int numOfChildViews = 0;
        List<Result> results = Lists.newArrayList();
        ResultScanner scanner = hTable.getScanner(scan);
        try {
            for (Result result = scanner.next(); (result != null); result = scanner.next()) {
                numOfChildViews++;
                ImmutableBytesWritable ptr = new ImmutableBytesWritable();
                ResultTuple resultTuple = new ResultTuple(result);
                resultTuple.getKey(ptr);
                byte[] key = ptr.copyBytes();
                if (checkTableKeyInRegion(key, region) != null) {
                    allViewsInCurrentRegion = false;
                }
                results.add(result);
            }
            TableViewFinderResult tableViewFinderResult = new TableViewFinderResult(results);
            if (numOfChildViews > 0 && !allViewsInCurrentRegion) {
                tableViewFinderResult.setAllViewsNotInSingleRegion();
            }
            return tableViewFinderResult;
        } finally {
                scanner.close();
        }
    } finally {
        hTable.close();
    }
}
 
Example 18
Source File: FlowQueueService.java    From hraven with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the flows currently listed in the given {@link Flow.Status}
 * @param cluster The cluster where flows have run
 * @param status The flows' status
 * @param limit Return up to this many Flow instances
 * @param user Filter flows returned to only this user (if present)
 * @param startRow Start results at this key. Use this in combination with
 *          {@code limit} to support pagination through the results.
 * @return a list of up to {@code limit} Flows
 * @throws IOException in the case of an error retrieving the data
 */
public List<Flow> getFlowsForStatus(String cluster, Flow.Status status,
    int limit, String user, byte[] startRow) throws IOException {
  byte[] rowPrefix = ByteUtil.join(Constants.SEP_BYTES,
      Bytes.toBytes(cluster), status.code(), Constants.EMPTY_BYTES);
  if (startRow == null) {
    startRow = rowPrefix;
  }
  Scan scan = new Scan(startRow);
  FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
  // early out when prefix ends
  filters.addFilter(new WhileMatchFilter(new PrefixFilter(rowPrefix)));
  if (user != null) {
    SingleColumnValueFilter userFilter = new SingleColumnValueFilter(
        Constants.INFO_FAM_BYTES, USER_NAME_COL_BYTES,
        CompareFilter.CompareOp.EQUAL, Bytes.toBytes(user));
    userFilter.setFilterIfMissing(true);
    filters.addFilter(userFilter);
  }
  scan.setFilter(filters);
  // TODO: need to constrain this by timerange as well to prevent unlimited
  // scans

  // get back the results in a single response
  scan.setCaching(limit);
  List<Flow> results = new ArrayList<Flow>(limit);
  ResultScanner scanner = null;
  Table flowQueueTable = null;
  try {
    flowQueueTable = hbaseConnection
        .getTable(TableName.valueOf(Constants.FLOW_QUEUE_TABLE));
    scanner = flowQueueTable.getScanner(scan);
    int cnt = 0;
    for (Result r : scanner) {
      Flow flow = createFlowFromResult(r);
      if (flow != null) {
        cnt++;
        results.add(flow);
      }
      if (cnt >= limit) {
        break;
      }
    }
  } finally {
    try {
    if (scanner != null) {
      scanner.close();
    }
    } finally {
      if (flowQueueTable != null) {
        flowQueueTable.close();
      }
    }
  }
  return results;
}