Backport hdp21 to 5.1

This is the same changes as in https://github.com/pentaho/pentaho-hadoop-shims/pull/121 for 5.1 branch.