The ELT function in Apache Hive helps in retrieving the Nth element from the list of the strings provided. This is equivalent to ELT in MySQL.
This function returns NULL if N is less than 1 or greater than the number of arguments. ELT() is the complement of FIELD().
Syntax: elt(N int,str1 string,str2 string,str3 string,…)
hive> SELECT ELT(1, ‘Aa’, ‘Bb’, ‘Cc’, ‘Dd’);
Returns ‘Aa’
hive> SELECT ELT(4, ‘Aa’, ‘Bb’, ‘Cc’, ‘Dd’);
Returns ‘Dd’
Please click on the follow button to receive updates on latest posts.
2 comments