scan

Definition

Scans the table and returns all the rows matching the given specifications.

Usage

  • Basic syntax:

    scan '[<namespace_name>:]<table_name>'[,
         '<column_family>:<column_qualifier>']
  • Using dictionaries:

    scan '[<namespace_name>:]<table_name>',
         {COLUMN => <columns_array[]>[,
         VERSIONS => <number_displayed_versions>][,
         TIMESTAMP => <cell_timestamp>][,
         TIMERANGE => [<timestamp_start>, <timestamp_end>][,
         ATTRIBUTES => {'<cell_attribute_name>' => '<cell_attribute_value>'[,...]}]}
  • Using table-scope time ranges:

    scan '[<namespace_name>:]<table_name>',
         {TIMERANGE => [<timestamp_start>, <timestamp_end>]}
  • Using filters:

    scan '[<namespace_name>:]<table_name>',
         {[ROWPREFIXFILTER => '<row_prefix>'][,
         FILTER => "<filter_description>"]}`
  • Including metrics:

    scan '[<namespace_name>:]<table_name>',
         {ALL_METRICS => true} | {METRICS => <metrics_array[]>}
  • Including the cells marked as deleted:

    scan '[<namespace_name>:]<table_name>',
         {RAW => true, VERSIONS => <number_displayed_versions>}
Arguments
Parameter Description

namespace_name

A namespace name

table_name

A table name

column_family

A column family name

column_qualifier

A column qualifier

columns_array

An array of strings specified in the format '<column_family>:<column_qualifier>', where <column_family> — a column family name; <column_qualifier> — a column qualifier

number_displayed_versions

A count of the cell versions to be displayed

cell_timestamp

A cell timestamp

timestamp_start

A start value for searching cells timestamps

timestamp_end

A stop value for searching cells timestamps

cell_attribute_name

A cell attribute name

cell_attribute_value

A value of the specified cell attribute

row_prefix

A prefix for searching row keys

filter_description

A filter used for searching the table cells

metrics_array

An array of statistical metrics names

Examples

Scanning all the table

hbase(main):003:0> scan 't4'
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
1 row(s)
Took 0.0744 seconds

Scanning the specified column cell

hbase(main):010:0> scan 't4', {COLUMN => 'cf1:c1'}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
1 row(s)
Took 0.0103 seconds

Scanning several columns

hbase(main):008:0> scan 't4', {COLUMN => ['cf1:c1', 'cf1:c2']}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
1 row(s)
Took 0.0149 seconds

Using TIMERANGE

hbase(main):009:0> scan 't4', {TIMERANGE => [1637324524743, 1637326735791]}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
1 row(s)
Took 0.0129 seconds

Scanning several value versions of one column

hbase(main):011:0> scan 't4', {COLUMN => 'cf1:c5', VERSIONS => 5}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
 r1                                      column=cf1:c5, timestamp=1637329190124, value=7738718a
 r1                                      column=cf1:c5, timestamp=1637329187604, value=7738718W
 r1                                      column=cf1:c5, timestamp=1637328326920, value=7738718M
1 row(s)
Took 0.0085 seconds

Scanning the specified value version

hbase(main):016:0> scan 't4', {COLUMN => 'cf1:c5', TIMESTAMP => 1637329190124}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c5, timestamp=1637329190124, value=7738718a
1 row(s)
Took 0.0070 seconds

Using a filter for column values

hbase(main):019:0> scan 't4', {FILTER => "ValueFilter(=, 'regexstring:value*')"}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
1 row(s)
Took 0.0380 seconds

Using a prefix for searching row keys

hbase(main):026:0> scan 't4', {ROWPREFIXFILTER => 'r'}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
1 row(s)
Took 0.0077 seconds

Getting all statistical metrics

hbase(main):022:0> scan 't4', {ALL_METRICS => true}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
1 row(s)

METRIC                                   VALUE
 BYTES_IN_REMOTE_RESULTS                 191
 BYTES_IN_RESULTS                        191
 MILLIS_BETWEEN_NEXTS                    5
 NOT_SERVING_REGION_EXCEPTION            0
 REGIONS_SCANNED                         1
 REMOTE_RPC_CALLS                        1
 REMOTE_RPC_RETRIES                      0
 ROWS_FILTERED                           0
 ROWS_SCANNED                            1
 RPC_CALLS                               1
 RPC_RETRIES                             0
Took 0.0079 seconds

Getting the defined statistical metrics

hbase(main):028:0> scan 't4', {METRICS => ['RPC_RETRIES', 'ROWS_FILTERED']}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
1 row(s)

METRIC                                   VALUE
 ROWS_FILTERED                           0
 RPC_RETRIES                             0
Took 0.0131 seconds

Including the cells marked for deleting

hbase(main):001:0> scan 't4', {RAW => true, VERSIONS => 10}
ROW                                      COLUMN+CELL
 r1                                      column=cf1:c1, timestamp=1637324524743, value=value1
 r1                                      column=cf1:c2, timestamp=2222221111111, value=value2
 r1                                      column=cf1:c3, timestamp=1637326735791, value=value3_new
 r1                                      column=cf1:c4, timestamp=1637324859512, value=value4
 r1                                      column=cf1:c5, timestamp=1637329193429, value=7738718b
 r1                                      column=cf1:c5, timestamp=1637329190124, value=7738718a
 r1                                      column=cf1:c5, timestamp=1637329187604, value=7738718W
 r1                                      column=cf1:c5, timestamp=1637328326920, value=7738718M
 r1                                      column=cf2:c1, timestamp=1637329303310, type=Delete
 r1                                      column=cf2:c1, timestamp=1637329303310, value=last
 r1                                      column=cf2:c1, timestamp=1637329264711, type=Delete
 r1                                      column=cf2:c1, timestamp=1637329264711, value=value_new_new2
 r1                                      column=cf2:c1, timestamp=1637329262403, type=Delete
 r1                                      column=cf2:c1, timestamp=1637329262403, value=value_new
 r1                                      column=cf2:c1, timestamp=1637329253123, type=Delete
 r1                                      column=cf2:c1, timestamp=1637329253123, value=value
1 row(s)
Took 0.3665 seconds
Found a mistake? Seleсt text and press Ctrl+Enter to report it