zoukankan      html  css  js  c++  java
  • hive之查询

    1.聚合处理,在组里面,每个用户购买的订单要大于1
    $hive>select cid count() max(price) from orders group by cid having count()>1;
    2.使用hive实现wordcount
    $hive>select split(line,' ') from doc; //按照空格来进行切割
    $hive>select t.word,count(t) from ((select explode(splite(line,' ')) as word from doc) as t) group by t.word order by count() desc limit 2; //对选中的数据进行炸裂操作
    $hive>select t.word,count(
    ) c from ((select explode(split(line,' ')) as word from doc) as t) group by t.word group by t.word order by c desc limit 2;
    //将单词统计的结果套到一个表中去
    create table stats as (select t.word,count(*) c from ((select explode(split(line,' ')) as word from doc) as t) group by t.word group by t.word order by c desc limit 2);

    //支持事务:
    $hive>create table tx(id int,name string ,age int)  clustered by(id) into 3 buckets  row format delimited fields terminated by ',' stored as orc tblproperties('transactional'='true');
  • 相关阅读:
    mysql-主主配置
    PHP安装-centos7
    mysql-M-S-S模型 中继器 级联
    安装mysql数据库-centos7
    正则表达式
    DJango安装-windows
    flask安装
    python安装centos7
    Linux——C库
    文件I/O
  • 原文地址:https://www.cnblogs.com/stone-learning/p/9280951.html
Copyright © 2011-2022 走看看