hive错误FAILED: SemanticException [Error 10041]: No partition predicate found for

FAILED: SemanticException [Error 10041]: No partition predicate found for Alias “average_sale_num_per_7d_query:temp1” Table “procurement_forecast_warehouse_stock_daily”
2018-04-25 17:20:09 [ INFO ] Traceback (most recent call last):
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver.py”, line 35, in
2018-04-25 17:20:09 [ INFO ] task.run()
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/task.py”, line 300, in run
2018-04-25 17:20:09 [ INFO ] engine.start()
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/engine/engine.py”, line 91, in start
2018-04-25 17:20:09 [ INFO ] action_func()
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/engine/engine.py”, line 106, in do_load
2018-04-25 17:20:09 [ INFO ] return self.target.load(self.taskconf)
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/dbhandler/hivehandler.py”, line 180, in load
2018-04-25 17:20:09 [ INFO ] self.execute_hql(hql)
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/dbhandler/hivehandler.py”, line 117, in execute_hql
2018-04-25 17:20:09 [ INFO ] process_shell(cmd)
2018-04-25 17:20:09 [ INFO ] File “/home/meicai/www/data/etl/sqlweaver/utils/processutil.py”, line 30, in process_shell
2018-04-25 17:20:09 [ INFO ] raise Exception(“shell execute error. command [{cmd}] exit with {returncode}”.format(**locals()))
2018-04-25 17:20:09 [ INFO ] Exception: shell execute error. command [set -e;set -o pipefail;hive -e “set mapred.job.name=procurement.procurement_inventory_rotation_days_report;set mapreduce.job.queuename=etl-test;set hive.mapred.mode=strict;use test_procurement;insert overwrite table procurement_inventory_rotation_days_report partition (dt=’2018-04-24’) SELECT t.sku_id AS sku_id, t.operate_area AS operate_area, ROUND(average_sale_num_per_7d_query.average_sale_num_per_7days,2) AS average_sale_num_per_7days, ROUND(per_7days_cat1_query.sale_money_per_7days_cat1,2) AS sale_money_per_7days_cat1, ROUND(per_7days_cat2_query.sale_money_per_7days_cat2,2) AS sale_money_per_7days_cat2, ROUND(inventory_money_7days_cat1_query.inventory_money_7days_cat1,2) AS inventory_money_7days_cat1, ROUND(inventory_money_7days_cat2_query.inventory_money_7days_cat2,2) AS inventory_money_7days_cat2, ROUND(average_sale_num_per_30d_query.average_sale_num_per_30days,2) AS average_sale_num_per_30days, ROUND(per_30days_cat1_query.sale_money_per_30days_cat1,2) AS sale_money_per_30days_cat1, ROUND(per_30days_cat2_query.sale_money_per_30days_cat2,2) AS sale_money_per_30days_cat2, ROUND(inventory_money_30days_cat1_query.inventory_money_30days_cat1,2) AS inventory_money_30days_cat1, ROUND(inventory_money_30days_cat2_query.inventory_money_30days_cat2,2) AS inventory_money_30days_cat2, CASE WHEN IF(average_sale_num_per_30d_query.average_sale_num_per_30days is NULL,0,average_sale_num_per_30d_query.average_sale_num_per_30days) = 0 THEN 99999 ELSE ROUND(IF(t.inventory_number is NULL,0,t.inventory_number)/average_sale_num_per_30d_query.average_sale_num_per_30days, 2) END AS rotation_days, CASE WHEN IF(per_30days_cat1_query.sale_money_per_30days_cat1 is NULL,0,per_30days_cat1_query.sale_money_per_30days_cat1) = 0 THEN 99999 ELSE ROUND(IF(inventory_money_30days_cat1_query.inventory_money_30days_cat1 is NULL,0,inventory_money_30days_cat1_query.inventory_money_30days_cat1)/per_30days_cat1_query.sale_money_per_30days_cat1, 2) END AS rotation_days_cat1, CASE WHEN IF(per_30days_cat2_query.sale_money_per_30days_cat2 is NULL,0,per_30days_cat2_query.sale_money_per_30days_cat2) = 0 THEN 99999 ELSE ROUND(IF(inventory_money_30days_cat2_query.inventory_money_30days_cat2 is NULL,0,inventory_money_30days_cat2_query.inventory_money_30days_cat2)/per_30days_cat2_query.sale_money_per_30days_cat2, 2) END AS rotation_days_cat2, t.data_date AS data_date, t.warehouse_id AS warehouse_id, t.city_id AS city_id FROM procurement.procurement_forecast_warehouse_stock_daily t LEFT JOIN ( SELECT AVG(temp1.split_number) AS average_sale_num_per_7days, temp1.sku_id AS sku_id, temp1.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp1 WHERE temp1.data_date > DATE_SUB(‘2018-04-24’,7) AND ‘2018-04-24’ >= temp1.data_date GROUP BY temp1.sku_id, temp1.operate_area ) average_sale_num_per_7d_query ON t.sku_id = average_sale_num_per_7d_query.sku_id AND t.operate_area = average_sale_num_per_7d_query.operate_area LEFT JOIN ( SELECT SUM(temp2.split_number * temp2.intime_price) / 7 AS sale_money_per_7days_cat1, temp2.class1_id AS class1_id, temp2.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp2 WHERE temp2.data_date >= DATE_SUB(‘2018-04-24’,7) AND ‘2018-04-24’ > temp2.data_date GROUP BY temp2.class1_id, temp2.operate_area ) per_7days_cat1_query ON t.class1_id = per_7days_cat1_query.class1_id AND t.operate_area = per_7days_cat1_query.operate_area LEFT JOIN ( SELECT SUM(temp3.split_number * temp3.intime_price) / 7 AS sale_money_per_7days_cat2, temp3.class1_id AS class1_id, temp3.class2_id AS class2_id, temp3.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp3 WHERE temp3.data_date >= DATE_SUB(‘2018-04-24’,7) AND ‘2018-04-24’ > temp3.data_date GROUP BY temp3.class1_id, temp3.class2_id, temp3.operate_area ) per_7days_cat2_query ON t.class1_id = per_7days_cat2_query.class1_id AND t.class2_id = per_7days_cat2_query.class2_id AND t.operate_area = per_7days_cat2_query.operate_area LEFT JOIN ( SELECT SUM(temp4.inventory_number * temp4.intime_price) AS inventory_money_7days_cat1, temp4.class1_id AS class1_id, temp4.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp4 WHERE temp4.data_date = ‘2018-04-24’ GROUP BY temp4.class1_id, temp4.operate_area ) inventory_money_7days_cat1_query ON t.class1_id = inventory_money_7days_cat1_query.class1_id AND t.operate_area = inventory_money_7days_cat1_query.operate_area LEFT JOIN ( SELECT SUM(temp5.inventory_number * temp5.intime_price) AS inventory_money_7days_cat2, temp5.class2_id AS class2_id, temp5.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp5 WHERE temp5.data_date = ‘2018-04-24’ GROUP BY temp5.class1_id,temp5.class2_id, temp5.operate_area ) inventory_money_7days_cat2_query ON t.class2_id = inventory_money_7days_cat2_query.class2_id AND t.operate_area = inventory_money_7days_cat2_query.operate_area LEFT JOIN ( SELECT AVG(temp6.split_number) AS average_sale_num_per_30days, temp6.sku_id AS sku_id, temp6.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp6 WHERE temp6.data_date > DATE_SUB(‘2018-04-24’,30) AND ‘2018-04-24’ >= temp6.data_date AND temp6.split_number > 0 GROUP BY temp6.sku_id, temp6.operate_area ) average_sale_num_per_30d_query ON t.sku_id = average_sale_num_per_30d_query.sku_id AND t.operate_area = average_sale_num_per_30d_query.operate_area LEFT JOIN ( SELECT SUM(temp7.split_number * temp7.intime_price) / 30 AS sale_money_per_30days_cat1, temp7.class1_id AS class1_id, temp7.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp7 WHERE temp7.data_date >= DATE_SUB(‘2018-04-24’,30) AND ‘2018-04-24’ > temp7.data_date GROUP BY temp7.class1_id, temp7.operate_area ) per_30days_cat1_query ON t.class1_id = per_30days_cat1_query.class1_id AND t.operate_area = per_30days_cat1_query.operate_area LEFT JOIN ( SELECT SUM(temp8.split_number * temp8.intime_price) / 30 AS sale_money_per_30days_cat2, temp8.class1_id AS class1_id, temp8.class2_id AS class2_id, temp8.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp8 WHERE temp8.data_date >= DATE_SUB(‘2018-04-24’,30) AND ‘2018-04-24’ > temp8.data_date GROUP BY temp8.class1_id, temp8.class2_id, temp8.operate_area ) per_30days_cat2_query ON t.class1_id = per_30days_cat2_query.class1_id AND t.class2_id = per_30days_cat2_query.class2_id AND t.operate_area = per_30days_cat2_query.operate_area LEFT JOIN ( SELECT SUM(temp9.inventory_number * temp9.intime_price) AS inventory_money_30days_cat1, temp9.class1_id AS class1_id, temp9.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp9 WHERE temp9.data_date = ‘2018-04-24’ GROUP BY temp9.class1_id, temp9.operate_area ) inventory_money_30days_cat1_query ON t.class1_id = inventory_money_30days_cat1_query.class1_id AND t.operate_area = inventory_money_30days_cat1_query.operate_area LEFT JOIN ( SELECT SUM(temp10.inventory_number * temp10.intime_price) AS inventory_money_30days_cat2, temp10.class2_id AS class2_id, temp10.operate_area AS operate_area FROM procurement.procurement_forecast_warehouse_stock_daily temp10 WHERE temp10.data_date = ‘2018-04-24’ GROUP BY temp10.class1_id,temp10.class2_id, temp10.operate_area ) inventory_money_30days_cat2_query ON t.class2_id = inventory_money_30days_cat2_query.class2_id AND t.operate_area = inventory_money_30days_cat2_query.operate_area WHERE t.data_date = ‘2018-04-24’”] exit with 57
2018-04-25 17:20:09 [ ERROR ] 返回值为: 1 ,13051 执行失败

**出现以上问题是分区表设置了严格模式,查询条件如果没有分区条件,就会出现次错误,解决方式:
1设置非严格模式
set hive.mapred.mode=unstrict;
2加上分区条件**

你可能感兴趣的:(数据库)