sparksql中使用with子查询,insert overwrite table的正确用法示例

set hive.exec.dynamic.partition=true;--是否允许动态分区
set hive.exec.dynamic.partition.mode=nonstrict;--分区模式设置
set spark.sql.adaptive.enabled=true;
set spark.sql.adaptive.shuffle.targetPostShuffleInputSize=128MB;

with v_is_freight_outstanding_cust as(
    select sum(un_receive_fee_amount) as un_receive_fee_amount,      /**未收款额**/
           sum(market_cushion_amount) as market_cushion_amount,      /**垫款金额**/
    	   payment_customer_id,  
    	   dmonth   
    from table
    group by bill_base.payment_customer_id,bill_base.dmonth  
)

insert overwrite table dws_biz.dws_biz_customer_cm  partition(dmonth)
select *
from v_is_freight_outstanding_cust 

你可能感兴趣的:(sql)