SPARK-2407: Added internal implementation of SQL SUBSTR()

This replaces the Hive UDF for SUBSTR(ING) with an implementation in Catalyst
and adds tests to verify correct operation.
Hive supports 0-based indexing in the same way as this patch.  I agree that supporting both in this way is ugly (both from an interface and from an implementation perspective), but it seems likely that people are depending on this behavior in the wild, doesn't it?