Would kvgen work on t.price?


On Thu, Feb 19, 2015 at 12:59 PM, Carol McDonald <[email protected]>
wrote:

> What is the best way to query an hbase table that has dynamic column names
> ? For example this table is similar to the opentsdb table, the rowkey is a
> stocksymbol followed by the date and hour , the Price column family column
> names are the seconds offset from the hour, so each row contains a bucket
> of  hours columns , the values are the price the stock sold for at that
> time.
> How can the dynamic names be used in queries ?
>
> 0: jdbc:drill:> select convert_from(row_key, 'UTF8') as tid, t.price as
> price from dfs.`/tables/trades_flat` t limit 5;
> +------------+------------+
> |    tid     |   price    |
> +------------+------------+
> | AMZN_2013102107 | {"3901713":"AAAAAAAAJUA="} |
> | AMZN_2013102108 | {"4600159":"AAAAAAAAE6o="} |
> | AMZN_2013102109 | {"3136026":"AAAAAAAAHL4=",
> "3448092":"AAAAAAAAJjI=","3926121":"AAAAAAAAHq0="} |
> | AMZN_2013102111 | {"1149689":"AAAAAAAAIuo=","3023456":"AAAAAAAAHRs="} |
> | AMZN_2013102112 | {"0705787":"AAAAAAAAInM=","4007774":"AAAAAAAAFUM="} |
> +------------+------------+
> 5 rows selected (0.766 seconds)
> 0: jdbc:drill:> select convert_from(row_key, 'UTF8') as tid, kvgen(t.price)
> as price from dfs.`/tables/trades_flat` t limit 5;
> +------------+------------+
> |    tid     |   price    |
> +------------+------------+
> | AMZN_2013102107 | [{"key":"3901713","value":"AAAAAAAAJUA="}] |
> | AMZN_2013102108 | [{"key":"4600159","value":"AAAAAAAAE6o="}] |
> | AMZN_2013102109 |
>
> [{"key":"3136026","value":"AAAAAAAAHL4="},{"key":"3448092","value":"AAAAAAAAJjI="},{"key":"3926121","value":"AAAAAAAAHq0="}]
> |
> | AMZN_2013102111 |
>
> [{"key":"1149689","value":"AAAAAAAAIuo="},{"key":"3023456","value":"AAAAAAAAHRs="}]
> |
> | AMZN_2013102112 |
>
> [{"key":"0705787","value":"AAAAAAAAInM="},{"key":"4007774","value":"AAAAAAAAFUM="}]
> |
> +------------+------------+
>

Reply via email to