title: How to return a "Tuple type" in a UDF in PySpark?
body: <p>All the <a href="https://spark.apache.org/docs/latest/api/python/_modules/pyspark/sql/types.html" rel="noreferrer">data types in <code>pyspark.sql.types</code> are</a>:</p>
  
  <pre><code>__all__ = [
      "DataType", "NullType", "StringType", "BinaryType", "BooleanType", "DateType",
      "TimestampType", "DecimalType", "DoubleType", "FloatType", "ByteType", "IntegerType",
      "LongType", "ShortType", "ArrayType", "MapType", "StructField", "StructType"]
  </code></pre>
  
  <p>I have to write a UDF (in pyspark) which returns an array of tuples. What do I give the second argument to it which is the return type of the udf method? It would be something on the lines of <code>ArrayType(TupleType())</code>...</p>