zoukankan      html  css  js  c++  java
  • [Hive_9] Hive 的排序


    0. 说明

      全排序(order by) | 部分排序(sort by) | hash 分区(distribute by)  | cluster by


    1. 前期准备

      1.1 建表

    create table user_order(id int, name string, age int, province string, city string)
    row format delimited
    fields terminated by ' ';

      1.2 设置 reduce 个数

    set mapreduce.job.reduces=2;

    2. 全排序(order by)


       使用一个 reduce,在真实使用中,需要加 limit 限制。

    truncate table user_order;
    insert into user_order select * from user_par order by id;

    3. 部分排序(sort by )

      在每个 reduce 中分别排序

    truncate table user_order;
    
    insert into user_order select * from user_par sort by id;

    4. hash 分区(distribute by )

      未排序

    truncate table user_order;
    
    insert into user_order select * from user_par distribute by id;

     5. cluster by

      cluster by = distribute by + sort by

    truncate table user_order;
    
    insert into user_order select * from user_par cluster by id;

  • 相关阅读:
    runtime iOS 运行时机制
    iOS 文件操作
    responseCode 状态吗查询
    iOS常用宏定义
    Block里用self造成循环引用
    iOS Block全面分析
    OC与Swift混编
    iOS打包app发给测试人员测试
    Swift UITextField
    sqilite学习
  • 原文地址:https://www.cnblogs.com/share23/p/10259896.html
Copyright © 2011-2022 走看看