zoukankan      html  css  js  c++  java
  • 3、hive操作

    进入hive

      beeline

      !connect jdbc:hive2://s101:10000/lx;auth=noSasl;

    建库并进入:

      create database umeng;

      use umeng;

    建立原始数据表并加载数据:

    use umeng;
    
    create external table if not exists raw_logs(servertimems float,
    servertimestr string,
    clientip string,
    clienttimems bigint,
    status int,
    json string)
    partitioned by(ym string,day string)
    row format delimited
    fields terminated by '#'
    lines terminated by '
    ';
    
    load data inpath '/user/centos/umeng/raw-logs/201810/29/2027' into table
    raw_logs partition(ym=201810,day=29);
    hive -f hive_create_table.sql

    创建日志子表

    -- 创建日志子表
    use umeng ;
    create table if not exists appstartuplogs (
      appchannel string ,
      appid string ,
      appplatform string ,
      appversion string ,
      brand string ,
      carrier string ,
      country string ,
    createdatms bigint ,
      deviceid string ,
      devicestyle string ,
      ipaddress string ,
      network string ,
      ostype string ,
      province string ,
      screensize string ,
      tenantid string)
    PARTITIONED BY (ym string, day string) 
    stored as parquet ;
    
    create table if not exists appeventlogs (
      appchannel string ,
      appid string ,
      appplatform string ,
      appversion string ,
      brand string ,
    createdatms bigint ,
      deviceid string ,
      devicestyle string ,
      eventdurationsecs string ,
      eventid string ,
      ostype string ,
      paramkeyvaluemap string ,
      tenantid string)
    PARTITIONED BY (ym string, day string) 
    stored as parquet ;
    
    create table if not exists apperrorlogs (
      appchannel string ,
      appid string ,
      appplatform string ,
      appversion string ,
      brand string ,
    createdatms bigint ,
      deviceid string ,
      devicestyle string ,
      errorbrief string ,
      errordetail string ,
      ostype string ,
      tenantid string)
    PARTITIONED BY (ym string, day string) 
    stored as parquet ;
    
    create table if not exists appusagelogs (
      appchannel string ,
      appid string ,
      appplatform string ,
      appversion string ,
      brand string ,
    createdatms bigint ,
      deviceid string ,
      devicestyle string ,
      ostype string ,
      singledownloadtraffic string ,
      singleuploadtraffic string ,
      singleusedurationsecs string ,
      tenantid string)
    PARTITIONED BY (ym string, day string) 
    stored as parquet ;
    
    create table if not exists apppagelogs (
      appchannel string ,
      appid string ,
      appplatform string ,
      appversion string ,
      brand string ,
    createdatms bigint ,
      deviceid string ,
      devicestyle string ,
      nextpage string ,
      ostype string ,
      pageid string ,
      pageviewcntinsession string ,
      staydurationsecs string ,
      tenantid string ,
      visitindex string)
    PARTITIONED BY (ym string, day string) 
    stored as parquet ;
    渐变 --> 突变
  • 相关阅读:
    jQuery tablesort插件推荐
    更改firefox默认搜索引擎
    Chrome Firefox 自定义背景色
    python 基础之列表切片内置方法
    python 基础之while无限循环
    python 基础之for循环有限循环
    python 基础之格式化输出
    nginx之HTTP模块配置
    Kubernetes之pod的属性
    nginx的工作流程
  • 原文地址:https://www.cnblogs.com/lybpy/p/9873885.html
Copyright © 2011-2022 走看看