zoukankan      html  css  js  c++  java
  • hive(2)数据类型和文件格式

    基本的数据类型

    Hive支持关系型数据中大多数基本的数据类型,同时也支持关系型数据库中很少出现的三种集合数据类型。

    集合数据类型

    Hive中的列支持使用struct、map、array集合数据类型,下表中的语法示例是调用的内置函数。

    例如:创建表:

    hive>create table emp(name string, salary float, subordinates array<string>, deductions map<string,float>, address struct<stree:string, city:string, state:string, zip:int>);

    文本文件数据编码

    下图表示Hive中默认的记录和字段分隔符

    例如:创建表的时候,指定分隔符(示例中的分隔符都是默认的分隔符,如果想要指定其他的分隔符,可以重新设置。)

    hive> create table emp(name string, salary float, subordinates array<string>, deductions map<string,float>, address struct<stree:string, city:string, state:string, zip:int>)
    row format delimited
       fields terminated by '01'
    collection items terminated by '02'
    map keys terminated by '03'
    lines terminated by ' '
    stored as textfile;



    说明:

    row format delimited(行格式化分隔符)关键字需要在其他字句(除stored as...)之前
    fields terminated by:字段终止,指定字段的分隔符
    collection items terminated by:集合元素间的分隔符
    map keys terminated by:map键值之间的分隔符
    lines terminated by:指定行分隔符
    lines terminated by和stored as 不需要row format delimited关键字。
  • 相关阅读:
    这一年来
    网络流复习笔记
    Codeforces Round #431
    Codeforces Round #398 (Div. 2)
    Codeforces Round #418 (Div. 2)
    【Codeforces 98E】 Help Shrek and Donkey 游戏策略神题
    【bzoj1878】[SDOI2009]HH的项链
    Round 403 div. 2
    Codeforces Round #417 (Div. 2)
    Codeforces Round #416 (Div. 2)
  • 原文地址:https://www.cnblogs.com/yjt1993/p/11059286.html
Copyright © 2011-2022 走看看