CREATE TABLEJson_nested_test (Countstring, usage string, pkg map<String,string>, Languages array<String>, store map<String,array<Map<String,string>>>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED asTextfile;
After creating the table Json_nested_test in the SQL above, the query found an error: failed with Exception Java. Io. Ioexception:org.. Hadoop. Hive. Serde2. Serdeexception: Java.. Ioexception: start Array expected
As a result of the following tests, it is found that org.apache.hive.hcatalog.data.JsonSerDe is insufficient for complex type support, such as MAP<STRING,ARRAY<STRING>> In this example, array as the value of map is not supported.
CREATE TABLEJson_nested_test_openx (Countstring, usage string, pkg map<String,string>, Languages array<String>, store map<String,array<Map<String,string>>>) ROW FORMAT SERDE'org.openx.data.jsonserde.JsonSerDe'STORED astextfile;CREATE TABLES1 (Countstring, usage string) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s1.txt'Overwrite into TableS1;Select * fromS1;CREATE TABLES2 (Countstring, usage string, pkg map<String,string>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s2.txt'Overwrite into TableS2;Select * fromS2;CREATE TABLES3 (Countstring, usage string, pkg map<String,string>, Languages array<String>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s3.txt'Overwrite into TableS3;Select * fromS3;CREATE TABLES4 (Countstring, usage string, pkg map<String,string>, Languages array<String>, store map<String,array<Map<String,string>>>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s4.txt'Overwrite into TableS4;Select * fromS4;CREATE TABLES5 (Store map<String,array<Map<String,string>>>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s5.txt'Overwrite into TableS5;Select * fromS5;CREATE TABLES6 (Store map<String,array<String>>) ROW FORMAT SERDE'org.apache.hive.hcatalog.data.JsonSerDe'STORED astextfile;LoadData local Inpath'/home/work/s6.txt'Overwrite into TableS6;Select * fromS6;
This Serde HIVE comes with a path of $hive_home/hcatalog/share/hcatalog/hive-hcatalog-core-1.2.1.jar, and it has other problems: empty rows in the data file are not supported
Troubleshooting hive Error: Org.apache.hadoop.hive.serde2.SerDeException:java.io.IOException:Start of Array expected