Uh oh!
There was an error while loading. Please reload this page.
[SPARK-12164] [SQL] Decode the encoded values and then display - #10215
[SPARK-12164] [SQL] Decode the encoded values and then display#10215gatorsmile wants to merge 5 commits into
Conversation
SparkQA
commented
Dec 9, 2015
Test build #47405 has finished for PR 10215 at commit
|
There was a problem hiding this comment.
Please revert these white space changes (I hate IDEA 15 too...)
There was a problem hiding this comment.
Yeah. Just upgraded to 15.0.2 The problem still exists...
SparkQA
commented
Dec 11, 2015
Test build #47597 has finished for PR 10215 at commit
|
There was a problem hiding this comment.
This indenting is wrong. https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide#SparkCodeStyleGuide-Indentation
4 space for function args that wrap.
marmbrus
commented
Dec 15, 2015
Can you add tests too? Probably in |
gatorsmile
commented
Dec 15, 2015
Sure, will do. Thanks! Update: To reuse the existing class |
There was a problem hiding this comment.
we should use javadoc style instead of scaladoc. i.e.
/**
*
*
*/
There was a problem hiding this comment.
Yeah. Will correct all these. Thanks!
gatorsmile
commented
Dec 15, 2015
To simplify the possible code merge, I combined the code changes in another related PR: #10165. Thank you! |
SparkQA
commented
Dec 15, 2015
Test build #47717 has finished for PR 10215 at commit
|
There was a problem hiding this comment.
So sorry for introducing these inconsistency. Undo the changes.
SparkQA
commented
Dec 15, 2015
Test build #47745 has finished for PR 10215 at commit
|
marmbrus
commented
Dec 16, 2015
Thanks, merging to master. |
Based on the suggestions from marmbrus cloud-fan in apache#10165 , this PR is to print the decoded values(user objects) in `Dataset.show` ```scala 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 if and only if the users override the `toString` function in the class `KryoClassData` ```scala override def toString: String = s"KryoClassData($a, $b)" ``` ``` +-------------------+ |value | +-------------------+ |KryoClassData(a, 1)| |KryoClassData(b, 2)| |KryoClassData(c, 3)| +-------------------+ ``` If users do not override the `toString` function, the results will be like ``` +---------------------------------------+ |value | +---------------------------------------+ |org.apache.spark.sql.KryoClassData68ef| |org.apache.spark.sql.KryoClassData6915| |org.apache.spark.sql.KryoClassData693b| +---------------------------------------+ ``` Question: Should we add another optional parameter in the function `show`? It will decide if the function `show` will display the hex values or the object values? Author: gatorsmile <gatorsmile@gmail.com> Closesapache#10215 from gatorsmile/showDecodedValue.
Based on the suggestions from @marmbrus@cloud-fan in #10165 , this PR is to print the decoded values(user objects) in
Dataset.showThe current output is like
After the fix, it will be like the below if and only if the users override the
toStringfunction in the classKryoClassDataIf users do not override the
toStringfunction, the results will be likeQuestion: Should we add another optional parameter in the function
show? It will decide if the functionshowwill display the hex values or the object values?