SPACE function in Apache Hive & Apache Impala

There are some functions that hardly come into use. Often this kind of function would have some other replacement that we use. SPACE is one of the functions introduced by Cloudera’s Impala, which returns the concatenated string to the specified number of spaces.

This function is available in Apache Hive too.

Let’s see what it does.

SELECT SPACE(10);

Result:

SPACE(10)
—————
                 

spacefn_2

Another example:
SELECT CONCAT(‘firstname’, space(1), ‘lastname’); 

spacefn_1

Result:
contact(‘firstname’, space(1), ‘lastname’)
————————————————
firstname lastname


Hope you liked this post.

4 comments

Leave a Reply