I have a requirement to calculate greatest value in multiple columns.
When I try to use greatest function as below, I'm getting
select name,greatest(sub1,sub2,sub3) from student;
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating greatest(sub1,sub2,sub3)
I'm using below as alternative. but, would like to know the issue with greatest.
select sort_array(arr)[size(arr)-1] from (select array(sub1,sub2,sub3) as arr from student)x;
hive Version : 1.2