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.
(Another point is that we need to branch on the index value even if we eliminate 0-based indexing in order to handle substrings taken from the end of the string.)