zoukankan      html  css  js  c++  java
  • hive数据库的哪些函数操作是否走MR

    平时我们用的HIVE 我们都知道 select * from table_name 不走MR 直接走HTTP 

    hive 0.10.0为了执行效率考虑,简单的查询,就是只是select,不带count,sum,group by这样的,都不走map/reduce,直接读取hdfs文件进行filter过滤。这样做的好处就是不新开mr任务,执行效率要提高不少,但是不好的地方就是用户界面不友好,有时候数据量大还是要等很长时间,但是又没有任何返回。

    改这个很简单,在hive-site.xml里面有个配置参数叫

    hive.fetch.task.conversion

    将这个参数设置为more,简单查询就不走map/reduce了,设置为minimal,就任何简单select都会走map/reduce

    造200W数据 格式为

    下面验证下like是否走MR

    1、等值比较: =

    select * from tp_200w_test where name='测试 '-等值条件下  --不走MR

    2、模糊比较: LIKE

    1)百分号在后面

    select * from tp_200w_test where name like '测%' and address like '江苏%'  --不走MR

    2)百分号在前面

    select * from tp_200w_test where name like '%试'  --不走MR

    3)百分号在2边

    select * from tp_200w_test where address like '%物联%'   --不走MR

    4)百分号加中间

     select * from tp_200w_test where address like '%物%联%'   --不走MR

    3、不等值比较: <>

    select * from tp_200w_test where id <>1    --不走MR

    4、小于比较:< ,大于比较> 小于等于<= 大于等于>= 

    select * from tp_200w_test where id <2  --不走MR

    select * from tp_200w_test where id >2  --不走MR

    select * from tp_200w_test where id >=2  --不走MR

    select * from tp_200w_test where id <=2  --不走MR

    5、空值判断is null, is not null 

    select * from tp_200w_test where id is null  --不走MR

    select * from tp_200w_test where id is not null  --不走MR

    6、JAVA的LIKE操作: RLIKE

    select * from tp_200w_test where id rlike '^f.*r$'  --不走MR

    对于集合统计函数

     1) count,sum ,min ,avg ,max 函数 都走MR,不在一一写

      

  • 相关阅读:
    Solr 配置中文分词器 IK
    Solr 访问 403 错误
    阿里巴巴在线代码检查工具
    『调错』OGG Error opening module ggjava_ue.dll
    『取巧』VS2015试用期过后 继续试用
    『开源』设置系统 主音量(0~100 静音) VolumeHelper 兼容 Xp Win7 .Net 20 AnyCPU
    『尝试』随手绘制几张点阵图片
    『实用』过滤字符串中的幽灵字符
    『转载』从内存资源中加载C++程序集:CMemLoadDll
    『开源重编译』System.Data.SQLite.dll 自适应 x86 x64 AnyCPU 重编译
  • 原文地址:https://www.cnblogs.com/staryea/p/8570538.html
Copyright © 2011-2022 走看看