I have data in json format.
- Correct
[{"text":"foo0","number":123},{"text":"foo1","number":345},{"text":"foo2","number":678},{"text":"foo3","number":901}]
- Incorrect
{"text":"foo0","number":123}{"text":"foo1","number":345} {"text":"foo2","number":678}{"text":"foo3","number":901}
Creating external table
create external table js_test_3
(
text string,
number string
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION '/Serde'
Then I launch
select *
from js_test_3
As a result I get
- Correct for json (retrieves as many elements as there are rows)
text number
{"number":"123","text":"foo0"} {"number":"345","text":"foo1"}
- For incorrect json-(retrieves only first element)
text number
foo0 123
How should I write script that creates list for which the result is correct?
text number
foo0 123
foo1 345
foo2 678
foo3 901
Thanks