hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: Questions about my bitcoin table
Date Sat, 26 Aug 2017 14:02:25 GMT
For #1, take a look at load-client in HBASE-14850 branch where you can find
example for converting bytes to int:

    auto int_val = hbase::BytesUtil::ToInt64(*(result->Value(family,
incrPrefix + col)));

you can use std::to_string(k) to convert integer to string.

For #3, adr is unique and if I add next row, old row will be replaced.

You can either make the row for each unique address wide by putting the
columns (for the address) in one row or, adding prefix / suffix to the
address so that the rows have unique row keys.


Cheers

On Sat, Aug 26, 2017 at 6:52 AM, Andrzej <borucki_andrzej@wp.pl> wrote:

> I need database for Bitcoin blockchain data. Previously I have two main
> tables : general and detail in SQL database. These tables were tables of
> transactions.
> Now I want table of address, because main search would be search by
> address. (unless is possible more than one index)
> First approach is:
> adr = address
> txh = transaction hash
> bh = block_height
> bt = block_time
> xtx = indx_tx = index transaction in block
> cin = count_in
> cout = count_out
> xio = indx_io = index input/output in transaction
>
>              family general                           family detail
> adr|| txh | bh  | bt | xtx| fee | size| cin | cout || type | xio |amount
> -----------------------------------------------------------------------
> aaa||  x  | 17  | t17|  5 | 200 | 450 |  5  |  2   ||  0   |  2  | 10
>    ||     |     |    |    |     |     |     |      ||  0   |  3  |  1
>    ||     |     |    |    |     |     |     |      ||  1   |  0  |  5
>    ||-----------------------------------------------------------------
>    ||  y  | 20  | t20|  1 | 100 | 250 |  1  |  1   ||  0   |  0  | 10
>    ||-----------------------------------------------------------------
>    ||  z  | 22  | t22| 100|     |  50 |  10 |  20  ||  1   |  5  | 10
>    ||     |     |    |    |     |     |     |      ||  1   |  6  | 10
> ----------------------------------------------------------------------
> abb|| x   | 17  | t17|  6 | 210 | 400 |  2  |  2   || 1    |  0  | 5
>    ||     |     |    |    |     |     |     |      || 1    |  1  | 5
>    ||-----------------------------------------------------------------
>    || x2  | 39  | t39|   0|     | 100 |   0 |  1   ||  1   |  0  | 12
>
> this nested approach has disadvantages:
> adr is unique and if I add next row, old row will be replaced.
>
> I am training after https://github.com/borneq/thri
> ft-exercises/blob/master/cpp/Hbase/DemoClient.cpp
> there are issues:
> - only families are created at start, columns are created when mutateRow:
>     mutations.push_back(Mutation());
>     mutations.back().column = "entry:num";
>     mutations.back().value = boost::lexical_cast<std::string>(i);
> cells are filled by string, not bytes, this has disadvantages:
> - hashes have 32 raw bytes or 64 hex strings
> - numbers must be saved as strings like 0000000004, this disable
> advantages numbers as integers.
>
> My questions:
> - how put data as bytes?
> - is possible make table as transaction (not address) table and efficient
> search address?
> - unique key can be more than one column?
> - better are two tables (general, detail) or one table with two families?
> - in DemoClient.cpp were problems with mutation to empty value - how save
> space for rows like:
>    ||     |     |    |    |     |     |     |      ||  0   |  3  |  1
> where are empty value because its value are redundant with first row.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message