• 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,不在一一写

      

  • 相关阅读:
    python3
    hive与hbase集成
    spark读取hbase形成RDD,存入hive或者spark_sql分析
    spark机器学习笔记01
    CodeForces 55D Beautiful numbers
    NOIP 2016 D2T2 蚯蚓](思维)
    SCOI 2009 围豆豆(状压DP)
    POJ 1852 Ants(贪心)
    STA树的深度(树型DP)
    HDU 5963 朋友 (找规律,思维)
  • 原文地址:https://www.cnblogs.com/staryea/p/8570538.html
Copyright © 2020-2023  润新知