incr

Definition

Increments a cell value at the specified table/row/column coordinates. The default incrementing step is 1, you can also define your own. Additionally, the command allows to modify the custom attributes or visibility of the cell value.

CAUTION
The incr command can be applied only to cells containing binary encoded (long) values.

Usage

incr '[<namespace_name>:]<table_name>',
     '<row_key>',
     '<column_family>:<column_qualifier>'[,
     '<incr_step>'][,
     {ATTRIBUTES => {'<cell_attribute_name>' => '<cell_attribute_value>'[,...]}}] | [, {VISIBILITY => '<visibility_expression>'}]
Arguments
Parameter Description

namespace_name

A namespace name

table_name

A table name

row_key

A row key

column_family

A column family name

column_qualifier

A column qualifier

incr_step

An incrementing step. The default value is 1

cell_attribute_name

A cell attribute name

cell_attribute_value

A value of the specified cell attribute

visibility_expression

A logical expression that refers to existing visibility labels. Can use the following logical operators: | (or), & (and). Examples: SECRET|PRIVATE, (SECRET&PRIVATE)|PUBLIC, SECRET&PRIVATE&PUBLIC

Examples

Incrementing with the default step 1

hbase(main):043:0> put 't4', 'r1', 'cf1:c5', 77387187
Took 0.0055 seconds
hbase(main):044:0> incr 't4', 'r1', 'cf1:c5'
COUNTER VALUE = 3978705112342280248
Took 0.0074 seconds
hbase(main):045:0> get 't4', 'r1', 'cf1:c5'
COLUMN                                   CELL
 cf1:c5                                  timestamp=1637328241031, value=77387188
1 row(s)
Took 0.0050 seconds

Incrementing with the defined step

hbase(main):047:0> incr 't4', 'r1', 'cf1:c5', 10
COUNTER VALUE = 3978705112342280258
Took 0.0074 seconds
hbase(main):048:0> get 't4', 'r1', 'cf1:c5'
COLUMN                                   CELL
 cf1:c5                                  timestamp=1637328290099, value=7738718B
1 row(s)
Took 0.0098 seconds
Found a mistake? Seleсt text and press Ctrl+Enter to report it