赞
踩
一.建表语句
- CREATE TABLE employee (
- name STRING
- ,salary FLOAT
- ,subordinates ARRAY <STRING>
- ,deductions MAP <STRING,FLOAT>
- )
- ROW FORMAT DELIMITED
- FIELDS TERMINATED BY ','
- COLLECTION items terminated BY '_'
- MAP KEYS TERMINATED BY ':'
- LINES TERMINATED BY '\n'
- STORED AS TEXTFILE;
二.语句分析
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' : 这个子句表明Hive将使用 ',' 字符作为列分隔符,即分隔字段。
ROW FORMAT DELIMITED COLLECTION items terminated BY '_' :这个子句表明Hive将使用 '_' 作为集合元素间的分隔符。
ROW FORMAT DELIMITED MAP KEYS TERMINATED BY ':' :这个子句表明Hive将使用 ':' 作为map的键和值之间的分隔符。
LINES TERMINATED BY:仅支持字符 '\n'。
子句 LINES TERMINATED BY 和 STORED AS 不需要 ROW FORMAT DELIMITED 关键字。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。