原子数据类型(9种)
整型:tinyint、smallint、int、bigint 浮点型:float、double 布尔:boolean 字符串:string 时间戳:timestamp
复杂数据类型
array
create table if not exists test_array( id int , work_add array< string> )
row format delimited fields terminated by "\t" collection items terminated by "," ;
-建表
load data local inpath "/home/hadoop/tmpdata/test_array" into table test_array;
- 导入数据
load data local inpath "/home/hadoop/tmpdata/test_array" into table test_array;
map
概念 同java中的map 键值对类型的(map<string,int>)。 建表
create table if not exists test_map( id int , piaofang map< string, int > ) row format delimited fields terminated by "\t" collection items terminated by "," map keys terminated by ":" ;
- 导入数据
load data local inpath "/home/hadoop/tmpdata/test_map" into table test_map;
struct
概述 结构体,类似于java中的,实体类类型。 建表
create table if not exists test_struct( id int , info struct< name:string, age:int , sex:string, add :string> ) row format delimited fields terminated by "\t" collection items terminated by "," ;
- 导入数据
load data local inpath "/home/hadoop/tmpdata/test_struct" into table test_struct;