Insert into externe table Hive


(anass) #1

Hi,
i want to insert into externe table Hive but i have this error.

Error: java.lang.NoClassDefFoundError: org/elasticsearch/hadoop/mr/EsOutputFormat$EsOutputCommitter

ADD JAR hdfs:/user/lib/elastic/commons-httpclient-3.1.jar;
ADD JAR hdfs:/user/lib/elastic/elasticsearch-hadoop-hive-2.3.3.jar;

CREATE EXTERNAL TABLE IF NOT EXISTS test (
id_indicateur string ,
date_indicateur timestamp,
DQ_cons_abo_date_reference date ,
DQ_cons_type_consentement string,
DQ_cons_source string ,
DQ_cons_etat string ,
DQ_abo_kafka_statut string ,
DQ_abo_code_retour string ,
DQ_abo_interpretation_etat string ,
DQ_cons_abo_nb_bp_prm bigint ,
DQ_cons_abo_nb_bp_prm_cumul bigint
)
COMMENT 'Table externe pour export vers ELK'
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource'='{ELASTIC_INDEX_NAME_VALUE}/{TYPE_ABO_VALUE}','es.index.auto.create'='false','es.nodes'='${NODES_ELASTICSEARCH_VALUE}','es.nodes.discovery'='false','es.nodes.client.only'='fa
lse','es.nodes.wan.only'='true');

INSERT INTO TABLE test
SELECT
'A' AS id_indicateur,
CURRENT_TIMESTAMP as date_indicateur,
date_sub(CURRENT_DATE(),1) AS DQ_cons_abo_date_reference,
B AS dq_cons_type_consentement,
t_iddemandeur AS DQ_cons_source,
'ACCEPTE' AS DQ_cons_etat,
C AS abo_kfk_statut,
D AS abo_dem_code_retour,
'ABO_ACCEPTE' AS DQ_abo_interpretation_etat,
count(distinct (case when TO_DATE(date_de_modification) = date_sub(CURRENT_DATE(),1) then CONCAT(bp,pdl) else null end)) as DQ_cons_abo_nb_bp_prm ,
count(distinct CONCAT(bp,pdl)) AS DQ_cons_abo_nb_bp_prm_cumul
FROM test2

GROUP BY codeobjetconsentement, t_iddemandeur, abo_kfk_statut, abo_dem_code_retour
;


(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.