Skip to content

FamilyFilter can't be created on the client #86

@therealnb

Description

@therealnb

I need a scan limited to one column family only.

I want to do something like this:

      var scan = client.getScanner(topicTokens.table),

      var f = {
        familyFilter: {
          compareFilter: {
            compareOp: 'EQUAL', 
            comparator: {
              substringComparator: {
                substr: topicTokens.family
              }
            }
          }
        }
      };  
      scan.setFilter(f);

But this gives me invalid field exceptions. I have to do something like this:

      var scan = client.getScanner(topicTokens.table),

      //singleColumnValueFilter is treated as special in scan.js so we have to 
      //use it to serialize the comparator (we can't do it directly).

      var dummy = {
        singleColumnValueFilter: {
          compareOp: "EQUAL",
          comparator: {
            substringComparator: {
              substr: topicTokens.family
            }
          }
        }
      }
      scan.setFilter(dummy);
      var f = {
        familyFilter: {
          compareFilter: {
            compareOp: 'EQUAL', 
            comparator: dummy.singleColumnValueFilter.comparator
          }
        }
      };  
      scan.setFilter(f);

I am not sure if I have missed another way of doing this. If so, I'd like to know how please.

The serialisation could be fixed to do this as in my first example, or you could expose scan.getFilter() and allow me to serialise it by hand. I wasn't sure of the rational behind making singleColumnValueFilter a special case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions