赞
踩
Hive创建表时指定的行受限(ROW FORMAT)配置标准HQL为:
...
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\u0001'
COLLECTION ITEMS TERMINATED BY ','
MAP KEYS TERMINATED BY ':'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
TBLPROPERTIES ('key'='value')
LOCATION '/user/hive/warehouse/...'
Hive默认分割符规则如下:
分隔符 | 受限项 | HQL语法 |
---|---|---|
^A(\001) | 字段(列)分隔符 | FIELDS TERMINATED BY |
^B(\002) | 集合(array、struct、map)元素(map为键值对)间的分隔符 | COLLECTION ITEMS TERMINATED BY |
^C(\003) | map元素键与值间的分隔符 | MAP KEYS TERMINATED BY |
\n | 行分隔符 | LINES TERMINATED BY |
Hive支持的存储数据的格式主要有:TEXTFILE(行式存储) 、SEQUENCEFILE(行式存储)、ORC(列式存储)、PARQUET(列式存储)。企业中使用ORC较多
更多关于存储格式的介绍见:https://www.cnblogs.com/jimmy888/p/13551605.html
Hive的数据压缩格式通过TBLPROPERTIES
关键字指定
SNAPPY压缩在企业中使用较多
1) ORC存储格式的SNAPPY压缩:
STORED AS ORC
TBLPROPERTIES ("orc.compress"="SNAPPY")
2) PARQUET存储格式的SNAPPY压缩:
STORED AS PARQUET
TBLPROPERTIES ("parquet.compression"="SNAPPY")
更多关于数据压缩的介绍见:https://www.cnblogs.com/jimmy888/p/13551605.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。