Error importing dataset in Hive

梦想的初衷 提交于 2019-12-24 21:27:20

问题


I have a dataset as follows,

John  Doe^A100000.0^AMary  Smith^BTodd  Jones^AFederal Taxes^C.2^BState Taxes^C.05^BInsurance^C.1^A1 Michigan Ave.^BChicago^BIL^B60600
Mary  Smith^A80000.0^ABill  King^AFederal  Taxes^C.2^BState Taxes^C.05^BInsurance^C.1^A100 Ontario St.^BChicago^BIL^B60601 Todd Jones^A70000.0^AFederal Taxes^C.15^BState Taxes^C.03^BInsurance^C.1^A200 Chicago Ave.^BOak Park^BIL^B60700
Bill  King^A60000.0^AFederal  Taxes^C.15^BState  Taxes^C.03^BInsurance^C.1^A300 Obscure Dr.^BObscuria^BIL^B60100

I have read in Hive documentation on "Text Encoding of Data values" on how hive decodes dataset having different "delimiters". For the above dataset, I have created a table with following schema,

CREATE TABLE employees
(
name STRING,
salary FLOAT,
subordinates ARRAY<STRING>,
deductions MAP<STRING, FLOAT>,
address STRUCT<street:STRING, city:STRING, state:STRING, zip:INT>
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\001'
COLLECTION ITEMS TERMINATED BY '\002'
MAP KEYS TERMINATED BY '\003'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;

But the dataset is not being imported properly into the table.

|employees.name|employees.salary|employees.subordinates|employees.deductions|employees.address|
|--------------|----------------|----------------------|--------------------|-----------------|
|John  Doe|NULL|["AMary  Smith"]|{"BTodd  Jones":null}|("street":"AFederal Taxes","city":null,"state":null,"zip":null}|
|Mary  Smith|NULL|["ABill  King"]|{"AFederal  Taxes":null}|{"street":"C.2","city":null,"state":null,"zip":null}|
|Bill  King|NULL|["AFederal  Taxes"]|{"C.15":null}|{"street":"BState  Taxes","city":null,"state":null,"zip":null} |

Can anyone please explain me why this is getting wrong though I am following as per documentation example in Page 45? Thanks in advance.

来源:https://stackoverflow.com/questions/47322547/error-importing-dataset-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!