[SPARK-2994][SQL] Support for udfs that take complex types

Author: Michael Armbrust <michael@databricks.com>

Closes #1915 from marmbrus/arrayUDF and squashes the following commits:

a1c503d [Michael Armbrust] Support for udfs that take complex types

(cherry picked from commit 9256d4a9c8c9ddb9ae6bbe3c3b99b03fb66b946b)
Signed-off-by: Michael Armbrust <michael@databricks.com>