zoukankan      html  css  js  c++  java
  • 配置Hive 支持 JSON 存储


    1、说明

    hive默认使用分隔符如空格,分号,"|",制表符	来格式化数据记录,对于复杂数据类型如json,nginx日志等,就没有办法拆分了,这时候需要更加强大的SerDe来处理复杂数据,
    如使用JsonSerDe或者使用正则表达式RegSerDe来处理。


    2、下载jar包

    json-serde-1.3.8-jar-with-dependencies.jar:
    http://www.congiu.net/hive-json-serde/1.3.8/hdp23/json-serde-1.3.8-jar-with-dependencies.jar
    
    
    json-udf-1.3.8-jar-with-dependencies.jar:
    http://www.congiu.net/hive-json-serde/1.3.8/hdp23/json-udf-1.3.8-jar-with-dependencies.jar


    3、配置hive

    1、将下载的json-serde-1.3.8-jar-with-dependencies.jar包放到hive的lib目录下
    
    2、配置hive-site.xml文件,添加jar包的声明,永久注册
        <property>
            <name>hive.aux.jars.path</name>
            <value>file:///soft/hive/lib/json-serde-1.3.8-jar-with-dependencies.jar</value>
        </property>
    
    3、设置不压缩存储
        <property>
            <name>hive.exec.compress.output</name>
            <value>false</value>
        </property>


    4、建表语句语法

    hive> create table test(id int , name string) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' STORED AS TEXTFILE;
  • 相关阅读:
    Python中怎么使用(冒泡排序)?
    Python中怎么定义与调用(函数)
    简易购物商城(1.0)版本
    非空即真 和 切片 处理方式
    python模块-random
    内置函数
    多维数组
    函数扩展
    文件操作扩展2
    文件操作扩展
  • 原文地址:https://www.cnblogs.com/weiyiming007/p/11969240.html
Copyright © 2011-2022 走看看