Github user koertkuipers commented on the issue:

    https://github.com/apache/spark/pull/15979
  
    admittedly the result looks weird. it really should be:
    
    +-----------+--------+
    |        key|count(1)|
    +-----------+--------+
    |       null|       1|
    |      [1,1]|       1|
    +-----------+--------+
    
    is that a separate bug or related? i remember running into this before,
    because serializing and then deserializing None comes back out as
    Some((null, null)), which causes NPE in codegen. i ran into this with
    Aggregator buffers.
    
    
    On Sun, Dec 4, 2016 at 12:13 PM, Koert Kuipers <ko...@tresata.com> wrote:
    
    > spark 2.0.x does not have mapValues. but this works:
    >
    > scala> Seq(("a", Some((1, 1))), ("a", None)).toDS.groupByKey(_._2).
    > count.show
    > +-----------+--------+
    > |        key|count(1)|
    > +-----------+--------+
    > |[null,null]|       1|
    > |      [1,1]|       1|
    > +-----------+--------+
    >
    >
    >
    > On Sun, Dec 4, 2016 at 9:59 AM, Koert Kuipers <ko...@tresata.com> wrote:
    >
    >> Yes it worked before
    >>
    >> On Dec 4, 2016 02:33, "Wenchen Fan" <notificati...@github.com> wrote:
    >>
    >>> val x: Dataset[String, Option[(String, String)]] = ...
    >>> x.groupByKey(_._1).mapValues(_._2).agg(someAgg)
    >>>
    >>> Does it work before?
    >>>
    >>> Please see the discussion in the JIRA: https://issues.apache.org/jira
    >>> /browse/SPARK-18251
    >>> Ideally we have a map between type T and catalyst schema, and Option[T]
    >>> maps to the same catalyst schema with T, with additional null handling.
    >>> We shouldn't change this mapping, which means we can't use a single 
field
    >>> struct type to represent Option[T].
    >>>
    >>> It's still possible to support Option[T] completely(without breaking
    >>> backward compatibility), but that may need a lof of hacky code and 
special
    >>> handling, I don't think it worth, as we can easy work around it, by
    >>> Tuple1.
    >>>
    >>> —
    >>> You are receiving this because you commented.
    >>> Reply to this email directly, view it on GitHub
    >>> <https://github.com/apache/spark/pull/15979#issuecomment-264689198>, or 
mute
    >>> the thread
    >>> 
<https://github.com/notifications/unsubscribe-auth/AAyIJD-_dmJODKn5_k8MHRFaJkHvL9uRks5rEmzCgaJpZM4K5fEL>
    >>> .
    >>>
    >>
    >



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to