GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/10215

    [SPARK-12164] [SQL] Decode the encoded values and then display

    Based on the suggestions from @marmbrus @cloud-fan in 
https://github.com/apache/spark/pull/10165 , this PR is to print the decoded 
values(user objects) in `Dataset.show`
    ```
        implicit val kryoEncoder = Encoders.kryo[KryoClassData]
        val ds = Seq(KryoClassData("a", 1), KryoClassData("b", 2), 
KryoClassData("c", 3)).toDS()
        ds.show(20, false);
    ```
    The current output is like 
    ```
    
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    |value                                                                      
                                                                                
                           |
    
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    |[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 
114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 
97, 116, -31, 1, 1, -126, 97, 2]|
    |[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 
114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 
97, 116, -31, 1, 1, -126, 98, 4]|
    |[1, 0, 111, 114, 103, 46, 97, 112, 97, 99, 104, 101, 46, 115, 112, 97, 
114, 107, 46, 115, 113, 108, 46, 75, 114, 121, 111, 67, 108, 97, 115, 115, 68, 
97, 116, -31, 1, 1, -126, 99, 6]|
    
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    ```
    After the fix, it will be like the below
    ```
    +-------------------+
    |value              |
    +-------------------+
    |KryoClassData(a, 1)|
    |KryoClassData(b, 2)|
    |KryoClassData(c, 3)|
    +-------------------+
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark showDecodedValue

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/10215.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10215
    
----
commit 1e1ad1970a8bf3d9076165074f18ee7f28ab4acd
Author: gatorsmile <[email protected]>
Date:   2015-12-09T04:08:17Z

    show decoded values.

----


---
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