DATAFU-68: SampleByKey can throw NullPointerException

https://issues.apache.org/jira/browse/DATAFU-68

Signed-off-by: Matthew Hayes <matthew.terence.hayes@gmail.com>