базовый стол:
hive> select values from t1;
1,3,6,7
3,6,7,1
взорваться с позиций
hive> select pos,value from t1 lateral view posexplode (split(values,",")) a as pos, value;
0 3
1 6
2 7
3 1
0 1
1 3
2 6
3 7
Сумма по позиции
hive> select pos,sum(cast(value as int)) from t1 lateral view posexplode (split(values,",")) a as pos, value group by pos;
0 4
1 9
2 13
3 8
Собрать значения сумм в виде списка
hive> select collect_list(sumvalue) from (select sum(cast(value as int)) as sumvalue from t1 lateral view posexplode (split(values,",")) a as pos, value group by pos)s;
[4,9,13,8]