Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FamilyFilter can't be created on the client #86

Open
therealnb opened this issue Mar 22, 2016 · 0 comments
Open

FamilyFilter can't be created on the client #86

therealnb opened this issue Mar 22, 2016 · 0 comments

Comments

@therealnb
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant