hexadecimal numeric representation in the HBase shell

Source: Internet
Author: User

When you use the HBase shell for a Get or scan operation, you will occasionally see some values being converted into 16, just like the following

value=w\x5c5\x80

So what exactly does this value equal? The algorithm is found after reviewing the data as follows

W-W ASCII code 16 binary to 0x57

\X5C---16 binary invariant 0x5C

5-5 ASCII code 16 binary for 0X35

\X80---16 binary invariant 0x80

So, from left to right, it's just.

0x575c3580-Turn decimal to 1465660800

So as usual, the following

Value=w]pa

W-W ASCII code 16 binary to 0x57

], ASCII code 16 binary is 0x5d

P-, p-ASCII code 16 binary is 0x50

A-a ASCII code 16 binary is 0x41

0x575d5041-Turn decimal to 1465733185

The above is the result of the query hexadecimal case, then if the query key itself is also converted to 16 what to do? Because sometimes there may be Chinese characters in key.

You can do the following:

Write a simple test program to turn the Chinese UTF-8 into 16 binary

System.out.println (Org.apache.commons.codec.binary.Hex.encodeHex ("Chinese". GetBytes ("UTF-8"));
Output Result: e4b8ade69687

System.out.println (New String (Org.apache.commons.codec.binary.Hex.decodeHex ("e4b8ade69687". ToCharArray ()), " UTF-8 "));
Output Result: Chinese

You can also use the site tools directly

Https://sites.google.com/site/nathanlexwww/tools/utf8-convert

After the turn, put the 16 binary in front of each 2-bit group plus \x.

Just like the above.

e4b8ade69687-\xe4\xb8\xad\xe6\x96\x87

As an example:

The key I want to check is

ce20cce09eeb4f8a6bb50e41953a55fcd|3| Steel Strong Yang 37| pa-1453442402-6111| pr-1453442402-3599

Direct

Get ' role_history_info ', ' ce20cce09eeb4f8a6bb50e41953a55fcd|3| steel strong Yang 37| pa-1453442402-6111| pr-1453442402-3599 '

No results

Turn the Chinese characters into the following method as follows

Steel->E992A2E99381E78388E998B3-\xe9\x92\xa2\xe9\x93\x81\xe7\x83\x88\xe9\x98\xb3

Single quote with key wrapped in double quotation mark when querying

Get ' Role_history_info ', "ce20cce09eeb4f8a6bb50e41953a55fcd|3|\xe9\x92\xa2\xe9\x93\x81\xe7\x83\x88\xe9\x98\xb337 | pa-1453442402-6111| pr-1453442402-3599 "

Check it out ...

hexadecimal numeric representation in the HBase shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.