It may not be obvious when using KeyValueTextInputFormat class that you need to provide a separator; otherwise it treats each line terminated by carriage return or new line character as key and value will be empty. A question on HCC triggered this exercise. Please refer to the question for full description.