[SPARK-2509][SQL] Add optimization for Substring.

`Substring` including `null` literal cases could be added to `NullPropagation`.
@rxin, thank you for your comment.
The rule `ConstantFolding` can be applied only if the expression is foldable, i.e. ALL of the child expressions are foldable, and the `NullPropagation` covers the case there exists at least one `null` literal regardless of foldabilities of the others.
So I think the cases are needed.

BTW, `Substring` can be foldable, right?