hivefans
11/15/2018 - 4:21 PM

HBase Stargate REST API Scanner Filter Examples

HBase Stargate REST API Scanner Filter Examples

Stargate Scanner Filter Examples

Introduction

So yeah... no documentation for the HBase REST API in regards to what should a filter look like...

So I installed Eclipse, got the library, and took some time to find some of the (seemingly) most useful filters you could use. I'm very green at anything regarding HBase, and I hope this will help anyone trying to get started with it.

What I discovered is that basically, attributes of the filter object follow the same naming than in the documentation. For this reason, I have made the link clickable and direct them to the HBase Class documentation attached to it; check for the instantiation argument names, and you will have your attribute list (more or less).

Don't forget, values are encoded.

References:

ColumnPrefixFilter

{
  "type": "ColumnPrefixFilter",
  "value": "cHJlZml4"
}

ColumnRangeFilter

{
  "type": "ColumnRangeFilter",
  "minColumn": "Zmx1ZmZ5",
  "minColumnInclusive": true,
  "maxColumn": "Zmx1ZmZ6",
  "maxColumnInclusive": false
}

ColumnPaginationFilter

Could not generate an example, but I guess it should be pretty simple to test if it works just by intuitively plugging variables a certain way...

DependentColumnFilter

null

FamilyFilter

{
  "type": "FamilyFilter",
  "op": "EQUAL",
  "comparator": {
    "type": "BinaryComparator",
    "value": "dGVzdHJvdw\u003d\u003d"
  }
}

FilterList with RowFilter and ColumnRangeFilter

{
  "type": "FilterList",
  "op": "MUST_PASS_ALL",
  "filters": [
    {
      "type": "RowFilter",
      "op": "EQUAL",
      "comparator": {
        "type": "BinaryComparator",
        "value": "dGVzdHJvdw\u003d\u003d"
      }
    },
    {
      "type": "ColumnRangeFilter",
      "minColumn": "Zmx1ZmZ5",
      "minColumnInclusive": true,
      "maxColumn": "Zmx1ZmZ6",
      "maxColumnInclusive": false
    }
  ]
}

FirstKeyOnlyFilter (Can be used for more efficiently perform row count operation)

{
  "type": "FirstKeyOnlyFilter"
}

InclusiveStopFilter

{
  "type": "InclusiveStopFilter",
  "value": "cm93a2V5"
}

MultipleColumnPrefixFilter

{
  "type": "MultipleColumnPrefixFilter",
  "prefixes": [
    "YWxwaGE\u003d",
    "YnJhdm8\u003d",
    "Y2hhcmxpZQ\u003d\u003d"
  ]
}

PageFilter

{
  "type": "PageFilter",
  "value": "10"
}

PrefixFilter

{
  "type": "PrefixFilter",
  "value": "cm93cHJlZml4"
}

QualifierFilter

{
  "type": "QualifierFilter",
  "op": "GREATER",
  "comparator": {
    "type": "BinaryComparator",
    "value": "cXVhbGlmaWVycHJlZml4"
  }
}

RowFilter

{
  "type": "RowFilter",
  "op": "EQUAL",
  "comparator": {
    "type": "BinaryComparator",
    "value": "dGVzdHJvdw\u003d\u003d"
  }
}

SingleColumnValueFilter

{
  "type": "SingleColumnValueFilter",
  "op": "EQUAL",
  "family": "ZmFtaWx5",
  "qualifier": "Y29sMQ\u003d\u003d",
  "latestVersion": true,
  "comparator": {
    "type": "BinaryComparator",
    "value": "MQ\u003d\u003d"
  }
}

TimestampsFilter

{
  "type": "TimestampsFilter",
  "timestamps": [
    "1351586939"
  ]
}