Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5802#discussion_r29489695
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -135,6 +158,24 @@ def sparkPartitionId():
         return Column(sc._jvm.functions.sparkPartitionId())
     
     
    +def struct(*cols):
    +    """Creates a new struct column.
    +
    +    :param cols: list of column names (string) or list of :class:`Column` 
expressions
    +        that are named or aliased.
    +
    +    >>> df.select(struct('age', 'name').alias("struct")).collect()
    +    [Row(struct=[u'2', u'Alice']), Row(struct=[u'5', u'Bob'])]
    +    >>> df.select(struct([df.age, df.name]).alias("struct")).collect()
    +    [Row(struct=[u'2', u'Alice']), Row(struct=[u'5', u'Bob'])]
    +    """
    +    sc = SparkContext._active_spark_context
    +    if len(cols) == 1 and isinstance(cols[0], (list, set)):
    +        cols = cols[0]
    +    jc = sc._jvm.functions.array(_to_seq(sc, cols, _to_java_column))
    --- End diff --
    
    oh shit this is why my test had a bug :p


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to