zoukankan      html  css  js  c++  java
  • hive 字段名称显示

    首先查看一个sql

    1、首先存在一个数据表tmp

    CREATE  TABLE tmp(
      platform string, 
      channel string, 
      chan_value string, 
      uid string, 
      host int, 
      logtime string, 
      bd_source string, 
      action string, 
      refer string, 
      back_url string, 
      browser string, 
      mobile string, 
      server_ip string, 
      ip string, 
      url string, 
      post string, 
      handle_time string, 
      logday string)

    2、查看这个表的数据

    hive> select * from tmp limit 2;
    OK
    adr    partner    touch.qunar.com    -    4    00:00:05    -    SgTrainStation    http://touch.qunar.com/baiduTrain.jsp?bd_source=alading_webapp        android    mozilla/5.0 (linux; android 4.4.2; hw-huawei p7-l09 build/huaweip7-l09) applewebkit/537.36 (khtml, like gecko) version/4.0 mobile safari/537.36    192.168.24.222    119.0.34.213    /SgTrainStation?keyword=上&_=1416153604205    -    1    20141117
    adr    partner    touch.qunar.com    -    0    00:00:05    -    SgTrainStation    http://touch.qunar.com/baiduTrain.jsp?bd_source=alading_webapp        android    mozilla/5.0 (linux; android 4.4.2; hw-huawei p7-l09 build/huaweip7-l09) applewebkit/537.36 (khtml, like gecko) version/4.0 mobile safari/537.36    192.168.24.222    119.0.34.213    /SgTrainStation?keyword=上&_=1416153604205    -    1    20141117
    Time taken: 2.549 seconds, Fetched: 2 row(s)

    这个数据十分不可读,那么就希望能格式化这些数据

    3、set hive.cli.print.header=true; // 打印列名

    hive> select * from tmp limit 2;     
    OK
    platform    channel    chan_value    uid    host    logtime    bd_source    action    refer    back_url    browser    mobile    server_ip    ip    url    post    handle_time    logday
    adr    partner    touch.qunar.com    -    4    00:00:05    -    SgTrainStation    http://touch.qunar.com/baiduTrain.jsp?bd_source=alading_webapp        android    mozilla/5.0 (linux; android 4.4.2; hw-huawei p7-l09 build/huaweip7-l09) applewebkit/537.36 (khtml, like gecko) version/4.0 mobile safari/537.36    192.168.24.222    119.0.34.213    /SgTrainStation?keyword=上&_=1416153604205    -    1    20141117
    adr    partner    touch.qunar.com    -    0    00:00:05    -    SgTrainStation    http://touch.qunar.com/baiduTrain.jsp?bd_source=alading_webapp        android    mozilla/5.0 (linux; android 4.4.2; hw-huawei p7-l09 build/huaweip7-l09) applewebkit/537.36 (khtml, like gecko) version/4.0 mobile safari/537.36    192.168.24.222    119.0.34.213    /SgTrainStation?keyword=上&_=1416153604205    -    1    20141117
    Time taken: 0.218 seconds, Fetched: 2 row(s)

    上面增加了列名

    4、set hive.cli.print.row.to.vertical=true; // 开启行转列功能, 前提必须开启打印列名功能

    5、set hive.cli.print.row.to.vertical.num=1; // 设置每行显示的列数

    ------------------这两步暂时没有生效,是xml文件设置的问题---------

  • 相关阅读:
    spring boot actuator监控需要注意的点
    spring boot actuator端点高级进阶metris指标详解、git配置详解、自定义扩展详解
    3、尚硅谷_SSM高级整合_创建Maven项目.avi
    elasticSearch插件metricbeat收集nginx的度量指标
    elasticSearch插件的安装以及使用nginx的modles收集nginx的日志
    服务治理平台微服务介绍
    skywalking面板功能介绍2
    skywalking中表字段的信息
    js总结33 :javascript-DOM节点属性
    js教程系列32 :javascript-DOM节点操作
  • 原文地址:https://www.cnblogs.com/liqiu/p/4154153.html
Copyright © 2011-2022 走看看