this works on drill .06 on the mapr drill sandbox :

create or replace view tview as select cast(convert_from(row_key, 'UTF8')
as bigint) as cust_id,
cast(t.loyalty.membership as varchar(20)) as membership from
dfs.`/tables/customers` t;

select sum(orders.order_total) as sales, tview.membership from hive.orders,
tview where orders.cust_id=tview.cust_id group by tview.membership;

______________________________________

HOWEVER this gives an error:

create or replace view tview as select cast(convert_from(row_key, 'UTF8')
as bigint) as cust_id,
cast(t.loyalty.membership as varchar(20)) as membership from
maprdb.customers t;

select sum(orders.order_total) as sales, tview.membership from hive.orders,
tview where orders.cust_id=tview.cust_id group by tview.membership;
______________________________________
this works:

create or replace view tview as select cast(row_key as bigint) as cust_id,
cast(t.loyalty.membership as varchar(20)) as membership
from maprdb.customers t;

select sum(orders.order_total) as sales, tview.membership from hive.orders,
tview where orders.cust_id=tview.cust_id group by tview.membership;

______________________________________
the data in this  HBase (maprdb) table is from a importtsv bulkimport of a
csv file  so it is all strings converted to bytearrays.  Is it recommended
to just  use cast in this case, which always works ? It is still not clear
to me when to use convert_from for an hbase table.

Reply via email to