Create table using appropriate delimiters as shown in below create statement
# create table complextype(field1 string, field2 string, field3 struct<field31:string,field32:string>, field4 string) row format delimited fields terminated by ',' collection items terminated by '$' stored as textfile;
Create CSV files using appropriate delimiters.
In below sample csv data, fields are terminated by comma(,) & complex data within the field is terminated by dollar($)
# hadoop fs -cat /tmp/complex.csv
value1,value2,value31$value32,value4
Load & query data
# load data inpath '/tmp/complex.csv' into table complextype;
# select * from complextype;
+---------------------+---------------------+--------------------------------------------+---------------------+--+
| complextype.field1 | complextype.field2 | complextype.field3 | complextype.field4 |
+---------------------+---------------------+--------------------------------------------+---------------------+--+
| value1 | value2 | {"field31":"value31","field32":"value32"} | value4 |
+---------------------+---------------------+--------------------------------------------+---------------------+--+
If my answer helps to solve your problem, accept the answer. It might help others in the community.