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.
This is the behavior of `IndexedSeqOptimized[A,B].slice` (and thus this patch) as well as of Hive, too.