Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 02:32 AM
I'm assuming you already found your answer, but since this is the top result that comes up when googling this issue and it remains unanswered, I'll add my 2 cents.
As far as I know, all the elements in your ArrayType have to be of the same Type.
So for instance, you can register a simple function returning a list of strings with the following syntax:
sqlContext.udf.register("your_func_name", your_func_name, ArrayType(StringType()))
I assume the reason your PySpark code works is because defininf the array elements as "StructTypes" provides a workaround for this restriction, which might not work the same in Scala.