Elkhan Eminov created HIVE-22061:
------------------------------------
Summary: Selecting from JsonSerDe backed table fails for array type
Key: HIVE-22061
URL: https://issues.apache.org/jira/browse/HIVE-22061
Project: Hive
Issue Type: Bug
Affects Versions: 1.1.0
Reporter: Elkhan Eminov
Table ddl:
CREATE EXTERNAL TABLE tmp.la_ocs_edr
(
SPEND_STRUCT map<string,array<map<string,string>>>
)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION '/tmp/vm';
Json file structure:
{"SPEND_STRUCT": \{"def":[{"COSTS":"0","BALANCE_TYPES":"128","BALANCES":"22"}]}}
\{"SPEND_STRUCT":
{"def":[{"COSTS":"0","BALANCE_TYPES":"478","BALANCES":"25"}]}}
A select query fails with:
hive> select * from json_example;
OK
Failed with exception
java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException:
java.io.IOException: Start of Array expected
Same result from beeline.
Strangely, inserting into the table as follows works and the JSON file is
populated properly:
hive> insert into json_example select
map("def",array(map("COSTS","0","BALANCE_TYPES","128","BALANCES","22"))) from
t1;
then
hive> !sh hdfs dfs -cat /user/hive/warehouse/test.db/json_example/*;
{"spend_struct":\{"def":[{"BALANCE_TYPES":"128","BALANCES":"22","COSTS":"0"}]}}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)