#!/bin/bash
sourceName=$1
writeName=$2
dt=$3
dtValue=$4
hive -e "set spark.app.name=clean_distinct_transfer_dept;
set spark.executor.instances=5;
set spark.executor.memory=10g;
set spark.executor.cores=2;
set spark.driver.memory=8g;
insert overwrite table $writeName.transfer_dept partition($dt='$dtValue') select t.id,t.unique_id,t.unique_id_lv1,t.unique_id_lv2,t.p900,t.patient_id,t.visit_id,t.admission_number,t.admission_date_time,t.tpatno,t.visit_type,t.sex,t.age,t.department_name,t.inpatient_area,t.room_no,t.bed_no,t.record_status,t.cop_status,t.admission_diagnosis,t.current_situation,t.current_diagnosis,t.transfer_detail_note,t.transfer_purpose,t.transfer_out_time,t.transfer_from_dept,t.transfer_out_area,t.transfer_in_time,t.transfer_to_dept,t.transfer_in_area,t.chief_complaint,t.tzl_process,t.matters_need_caution,t.treatment_plan,t.transfer_type,t.doctor_sign,t.record_time,t.data_version,t.data_db_source,t.data_table_source,t.data_field_source,t.created_at,t.creator,t.updated_at,t.updator,t.updated_note,t.data_state,t.disable_time,t.disable_operator,t.disable_note,t.data_check,t.del_flag,t.batch_number,t.md5,t.union_flag,t.ana_md5,t.id_source,t.atlas_flag from ( select a.*,row_number() over(partition by a.patient_id,a.visit_id,a.admission_number,a.admission_date_time,a.tpatno,a.visit_type,a.sex,a.age,a.department_name,a.inpatient_area,a.room_no,a.bed_no,a.record_status,a.cop_status,a.admission_diagnosis,a.current_situation,a.current_diagnosis,a.transfer_detail_note,a.transfer_purpose,a.transfer_out_time,a.transfer_from_dept,a.transfer_out_area,a.transfer_in_time,a.transfer_to_dept,a.transfer_in_area,a.chief_complaint,a.tzl_process,a.matters_need_caution,a.treatment_plan,a.transfer_type,a.doctor_sign,a.record_time) as num from $sourceName.transfer_dept as a where $dt='$dtValue') as t where t.num = 1;"
hive脚本开发
于 2021-12-07 14:27:13 首次发布