Verify castability before actually doing it

We are experiencing problems with mis-formed lines, where we think a
field is supposed to be a Map, but due to a series of unfortunate events
it is actually a String. When we encounter this line, Hive flips out and
fails the entire job due to a recurring ClassCastException.

This patch simply checks the castability of the variable before actually
doing the cast. It returns NULL if it's not castable, and logs the
toString() of it at warn level.