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 ;
    渐变 --> 突变
  • 相关阅读:
    SQL SERVER代理作业删除失败问题
    SQLSERVER数据库管理员的专用连接DAC
    SQL Server Management Studio自定义快捷键
    Delphi判断字符串中是否包含汉字,并返回汉字位置
    delphi TStringList 用法详解
    iOS开发-LayoutGuide(从top/bottom LayoutGuide到Safe Area)
    Runtime 全方位装逼指南
    iOS UIFileSharingEnabled
    info.plist的选项含义
    检查iOS项目中是否使用了IDFA
  • 原文地址:https://www.cnblogs.com/lybpy/p/9873885.html
Copyright © 2011-2022 走看看