복붙노트

[HADOOP] 병렬로 IN 절 매개 변수를 사용하여 하이브 쿼리를 실행합니다.

HADOOP

병렬로 IN 절 매개 변수를 사용하여 하이브 쿼리를 실행합니다.

나는 아래와 같은 하이브 쿼리를 가지고있다.

select a.x as column from table1 a where a.y in (<long comma-separated list of parameters>)
union all
select b.x as column from table2 b where b.y in (<long comma-separated list of parameters>)

hive.exec.parallel을 true로 설정 했으므로이 두 쿼리 사이의 병렬 처리를 모두 도와줍니다.

하지만, IN 절은 쉼표로 구분 된 값이 많으며 각 값은 1 작업에서 한 번 취한 다음 다음 값으로 가져옵니다. 이것은 실제로 순차적으로 실행됩니다.

활성화 된 경우 IN 절의 매개 변수에 대해 데이터를 병렬로 가져올 수있는 하이브 매개 변수가 있습니까?

현재, 내가 가지고있는 솔루션은 하나의 IN 절이 아닌 여러 번 선택 쿼리를 실행하는 것입니다.

해결법

  1. ==============================

    1.보다 나은 병렬 처리를 위해 별도의 쿼리로 동일한 데이터를 여러 번 읽을 필요가 없습니다. 동일한 매퍼와 감속기의 병렬 처리를 조정하십시오.

    보다 나은 병렬 처리를 위해 별도의 쿼리로 동일한 데이터를 여러 번 읽을 필요가 없습니다. 동일한 매퍼와 감속기의 병렬 처리를 조정하십시오.

    우선, 벡터화를 사용하여 PPD를 활성화하고 CBO 및 Tez를 사용하십시오.

    SET hive.optimize.ppd=true;
    SET hive.optimize.ppd.storage=true;
    SET hive.vectorized.execution.enabled=true;
    SET hive.vectorized.execution.reduce.enabled = true;
    SET hive.cbo.enable=true;
    set hive.stats.autogather=true;
    set hive.compute.query.using.stats=true;
    set hive.stats.fetch.partition.stats=true;
    set hive.execution.engine=tez;
    SET hive.stats.fetch.column.stats=true;
    SET hive.tez.auto.reducer.parallelism=true; 
    

    Tez의 매퍼 설정 예 :

    set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
    set tez.grouping.max-size=67108864;
    set tez.grouping.min-size=32000000;
    

    테퍼 대신 MR에서 실행하기로 결정한 경우 매퍼 설정 예 :

    set mapreduce.input.fileinputformat.split.minsize=16777216; -- 16 MB
    set mapreduce.input.fileinputformat.split.maxsize=1073741824; -- 1 GB
    

    감속기에 대한 예시 설정 :

    set hive.exec.reducers.bytes.per.reducer=67108864; --decrease this to increase the number of reducers
    

    이 설정으로 재생하십시오. 성공 기준은 더 많은 맵퍼 / 리듀서이며지도와 축소 단계가 더 빠르게 실행됩니다.

    Tez 튜닝 방법에 대한 더 자세한 내용은이 기사를 참조하십시오. https://community.hortonworks.com/articles/14309/demystify-tez-tuning-step-by-step.html

  2. from https://stackoverflow.com/questions/48484391/execute-hive-query-with-in-clause-parameters-in-parallel by cc-by-sa and MIT license