Data types

Let's have a look at the data types available in HBase. In HBase, everything is a byte. It is a byte in and a byte out, which means everything that has to be written in HBase needs to be converted/encoded to a byte array, and while reading, it can again be converted/decoded to an equivalent representation. This facility is provided by the put and result interfaces. So, no matter what the type of data is, as long as it can be converted to a byte array, it can be stored in an HBase table. The input data type might be an integer, image, or object, or a long or string. All of these can be converted to a byte array and stored in an HBase table.

Since we can store any type of data, it does not imply that we can convert and store huge amounts of data into an HBase cell as there is a practical limit; more than 20 MB is a big thing to ask for. So, it's better that we choose smaller data that can be converted and stored in an HBase cell, and for huge amounts of data, we can choose other options such as storing it on an HDFS file system, and storing the path in the HBase cell to avoid very prolonged read operations. Lengthy read operations might prevent client calls.

In the next section, we will look at various types of data, converting and storing it in HBase tables using put, or reading the data to equivalent representations using get and scan.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.107.152