DruidStorageHandler

Dear all,

  • I want to creat hive table from druid.

CREATE TABLE niotopic_int

STORED BY ‘org.apache.hadoop.hive.druid.DruidStorageHandler’

TBLPROPERTIES (

“druid.segment.granularity” = “hour”,

“druid.query.granularity” = “minute”)

AS

SELECT

from_unixtime(unix_timestamp(time_stamp ,‘yyyyMMddHHmmss’), ‘yyyy-MM-dd HH:mm:ss’) as __time,

cast(msisdn as string) msisdn,

cast(imei as string) imei,

cast(imsi as string) imsi,

cast(location as string) location,

cast(client_ip as string) client_ip,

cast(application_category as string) application_category,

cast(application_name as string) application_name,

cast(rat_type as string) rat_type,

vol_in,

vol_out,

record_duration,

rxmit_vol_in,

rxmit_vol_out,

pkt_in,

pkt_out,

rxmit_pkt_in,

rxmit_pkt_out,

reorder_pkt,

rxmit_pkt,

client_delay,

first_data_delay,

std,

network_delay

FROM niotopic_int;

But when running in beeline it return error:

Error: Error while compiling statement: FAILED: SemanticException Cannot find class ‘org.apache.hadoop.hive.druid.DruidStorageHandler’ (state=42000,code=40000)

Anyone can help me ?

Hi Hop Chu Quang,

It seems you are using apache hive handler for the druid, I think you should ask this question in hive forum:
On your error: If you are using HiveServer2 Interactive, I think hive-druid-handler.jar would be added into service classpath by default othervise you may need to run add jars <jar path>/hive-druid-handler.jar to load the hive-DruidStorageHandler before creating the hive table with the DruidStorageHandler.
https://community.cloudera.com/t5/Support-Questions/Hive-druid-handler-quot-java-lang-NoClassDefFoundError-org/td-p/231413

Thanks and Regards,

Vaibhav

Thanks very much Vaibhav.
I’ll try to your guide.