Filtering SCAN Operation Results Example

This example shows filtering on the results of a SCAN operation.

for (uint32_t i = 0; i < num_filters; ++i) {
    hb_scanner_t scanner = NULL;
    hb_scanner_create(client, &scanner);
    hb_scanner_set_table(scanner, table_name, table_name_len);
    hb_scanner_set_num_max_rows(scanner, 3);  // maximum 3 rows at a time
    hb_scanner_set_num_versions(scanner, 10); // up to 10 versions of the cell
    hb_scanner_set_filter(scanner, (byte_t *)filters[i], strlen(filters[i]));
    hb_scanner_next(scanner, scan_callback, NULL); // dispatch the call

This example uses the following array of filters:

static char filters[][200] = {"RandomRowFilter(0.5)",
       "PrefixFilter('row_') AND QualifierFilter(<,'binaryprefix:g')",
       "SKIP TimestampsFilter(1392222222222)",
       "WHILE ValueFilter(=,'binaryprefix:cell2_value_v1')",
Note: For more information about suppport for HBase Java Filters by the MapR Database C API, see HBase Java Filters Support