• 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 ;
    渐变 --> 突变
  • 相关阅读:
    Apriori算法原理总结
    FP Tree算法原理总结
    用Spark学习FP Tree算法和PrefixSpan算法
    《万历十五年》段落摘抄
    DPDK mempool
    DPDK PCIe 与 包处理
    《汇编语言》-- 控制执行流程
    《黑客攻防技术-系统实战》第二章--栈溢出4
    DPDK报文转发
    DPDK同步互斥机制
  • 原文地址:https://www.cnblogs.com/lybpy/p/9873885.html
Copyright © 2020-2023  润新知