SELECT lpad("String",10,'');After researching, I concluded that it was caused by a Hive’s upstream bug: HIVE-15792. This has been fixed in upstream Hive 2.3.0 and in CDH5.12.1 and CDH5.13.0 onwards. Currently, the only workaround is to have a non-empty string passed into the third parameter of the function, so below query will work:
SELECT lpad("String",10,'v');The issue is basically caused by a code logic that will run in a loop infinitely when an empty string is passed into the function. You can have a look at the Patch in the JIRA for details of the change. Hope above information helps.