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.
It looks like from [1] and [2] that Hive and SQL by default refer users to use 1-based indexing (and the links don't seem to mention 0-based at all). Even though they do support so, this subtle fact necessitates a couple branchings in the implementation which might cause us some performance penalty. What do you & people think about supporting 1-based indexing only? +@marmbrus @rxin