In Hive I have a table with a column as string datatype and it contains set of numbers say marks. So I want to apply some arithmetic operations like addition, so I used split command and it returns array. Bt I can't apply addition to the array I think I need to convert into array to apply any arithmetic operations. I used command followed
select sum(a) from (select split(marks, ':') as a from tbl) b;
And I tried to cast it into array also bt not working giving some error. I tried following commands
select sum(a) from (select cast(split(marks, ':') as a array<int>) from table) b;
select sum(a) from (select cast(b) as array<int> from (select split(marks, ':') as b from tbl) c) d;
Please suggest me the solution for this.. And also how to cast array to array