首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的配置单元查询运行了很长时间

我的配置单元查询运行了很长时间
EN

Stack Overflow用户
提问于 2017-03-15 03:27:43
回答 1查看 1.2K关注 0票数 0

我从配置单元CLI运行了以下查询。查询运行了很长一段时间,之后就失败了。

代码语言:javascript
复制
SET hive.tez.container.size=10240; 
SET hive.tez.java.opts=-Xmx8192m; 
set tez.runtime.io.sort.mb=4096; 
set tez.runtime.unordered.output.buffer.size-mb=1024; 
set hive.exec.dynamic.partition=true; 
set hive.exec.dynamic.partition.mode=nonstrict; 
set hive.vectorized.execution.reduce.enabled; 
set hive.execution.engine=tez;

SELECT 
cust_his.cname AS cname  
,cust_his.creg AS creg 
,Upper(Trim(cust_his.ccountry)) AS ccountry 
,Upper(Trim(cust_his.cloc)) AS cloc
FROM  
customer_history cust_his
WHERE  
cust_his.cust_d BETWEEN 20160501  AND 20160531
AND Substr(Trim(cust_his.cloc), 1, Locate('|', cust_his.cloc, 1) - 1) <> ''
AND Substr(Trim(cust_his.cloc), 1, Locate('|', cust_his.cloc, 1) - 1) IS NOT NULL
AND cast(Trim(cust_his.cmfid) as int) NOT IN ( 1,2,3 )
AND cust_his.cmat = '8';

该表按cust_d列进行分区。该表有420TB的数据。

请帮我解决这个问题。

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2017-03-15 03:43:04

您的查询只能在映射器上运行,因为没有group by或join或文件合并。

检查有多少映射器启动,分区修剪是否有效,检查查询计划。如果分区修剪不起作用,试着用>=<=替换BETWEEN条件,有时它会有帮助,向量化执行可能不支持你的版本中的BETWEEN,根据这个:https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_dataintegration/content/query-vectorization.html

还要加上这个:设置hive.vectorized.execution.enabled = true;

这个条件也是多余的:

代码语言:javascript
复制
AND Substr(Trim(cust_his.cloc), 1, Locate('|', cust_his.cloc, 1) - 1) IS NOT NULL

您不需要它,因为您已经具有相同的<> '',这将自动排除nulls

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42794877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档