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;
  • 相关阅读:
    JS数组的相关方法
    JS字符串的相关方法
    重回我的园区
    STM32F405串口UART4波特率注意问题
    NXP MCU开始学习中
    锂电池测试
    FPGA与STM32并口通信
    NXP LPC4350绝对强悍,准备入手学习
    SDRAM+FPGA+MCU
    STM32+FPGA通信成功
  • 原文地址:https://www.cnblogs.com/weiyiming007/p/11969240.html
Copyright © 2011-2022 走看看