Class: Apache::Hadoop::Hbase::Thrift::TCell
- Inherits:
-
Object
- Object
- Apache::Hadoop::Hbase::Thrift::TCell
- Includes:
- Thrift::Struct, Thrift::Struct_Union
- Defined in:
- lib/thrift/hbase_types.rb,
lib/hbaserb/extensions.rb
Overview
TCell - Used to transport a cell value (byte[]) and the timestamp it was stored with together as a result for get and getRow methods. This promotes the timestamp of a cell to a first-class value, making it easy to take note of temporal data. Cell is used all the way from HStore up to HTable.
Constant Summary collapse
- VALUE =
1
- TIMESTAMP =
2
- FIELDS =
{ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true}, TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'} }
Instance Method Summary collapse
- #struct_fields ⇒ Object
- #to_double ⇒ Object
- #to_i16 ⇒ Object
- #to_i32 ⇒ Object
- #to_i64 ⇒ Object
- #validate ⇒ Object
Instance Method Details
#struct_fields ⇒ Object
26 |
# File 'lib/thrift/hbase_types.rb', line 26 def struct_fields; FIELDS; end |
#to_double ⇒ Object
29 30 31 |
# File 'lib/hbaserb/extensions.rb', line 29 def to_double value.unpack('G').first end |
#to_i16 ⇒ Object
8 9 10 11 |
# File 'lib/hbaserb/extensions.rb', line 8 def to_i16 val, = value.unpack('n') (val > 0x7fff) ? (0 - ((val - 1) ^ 0xffff)) : val end |
#to_i32 ⇒ Object
13 14 15 16 |
# File 'lib/hbaserb/extensions.rb', line 13 def to_i32 val, = value.unpack('N') (val > 0x7fffffff) ? (0 - ((val - 1) ^ 0xffffffff)) : val end |
#to_i64 ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hbaserb/extensions.rb', line 18 def to_i64 hi, lo = value.unpack('N2') if (hi > 0x7fffffff) hi ^= 0xffffffff lo ^= 0xffffffff 0 - (hi << 32) - lo - 1 else (hi << 32) + lo end end |
#validate ⇒ Object
28 29 |
# File 'lib/thrift/hbase_types.rb', line 28 def validate end |