Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17608][SPARKR]:Long type has incorrect serialization/deserialization - #17640
[SPARK-17608][SPARKR]:Long type has incorrect serialization/deserialization#17640wangmiao1981 wants to merge 3 commits into
Conversation
frreiss
commented
Apr 14, 2017
Overall, this looks like a sensible approach to a messy problem. |
SparkQA
commented
Apr 14, 2017
Test build #75815 has finished for PR 17640 at commit
|
I will some bound check and error handling. I think there should be some generic handling approach in the Scala side, because |
wangmiao1981
commented
Apr 14, 2017
cc @felixcheung |
wangmiao1981
commented
Apr 15, 2017
If I use very big number, then sparkR shell will get the following output:
So the overflow problem has been taken care of in the Scala side. We don't have to add additional handling in R side. |
felixcheung
commented
Apr 15, 2017
via email
What's the number you use for this big number? |
felixcheung
commented
Apr 16, 2017
Thanks @wangmiao1981 Does this address SPARK-12360 too? |
wangmiao1981
commented
Apr 17, 2017
For 138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240138074279341524013807427934152401380742793415240 |
wangmiao1981
commented
Apr 17, 2017
Based on my understanding, it does not directly solvethe 12360. This one just solves the serialization of a specific type |
shivaram
commented
Apr 17, 2017
+1 on what @felixcheung said -- It'll be good to have more tests in test_Serde.R. Other than that the change looks fine |
wangmiao1981
commented
Apr 17, 2017
I am adding more tests right now. |
felixcheung
commented
Apr 17, 2017
these are great tests to add... thinking more about this, I think these are actually testing large numeric values, not large integer value, because in R, though I'm not sure we could specify that as integer as R integer is only 32-bit. so we need a way to get bigint back from JVM side - and since we can't specify bigint on the R side (R integer is only 32-bit), should there be a SQL function test to create such value (and new column with the bigint type) from within the JVM? |
SparkQA
commented
Apr 17, 2017
Test build #75862 has finished for PR 17640 at commit
|
felixcheung
commented
Apr 19, 2017
@wangmiao1981 do you want to get this into 2.2? |
wangmiao1981
commented
Apr 23, 2017
@felixcheung I just came back from vacation. I will make changes now. Thanks! |
SparkQA
commented
Apr 25, 2017
Test build #76121 has finished for PR 17640 at commit
|
felixcheung
commented
Apr 25, 2017
let me know if I'm mistaken, I think tests in here are only testing doubles/numerics instead of large int? |
There was a problem hiding this comment.
This one tests bigint
There was a problem hiding this comment.
actually, I'm not sure.
Walking through the code, createDataFrame calls parallelize which eventually calls R's serialize. Since these big values are actually numeric, and not integer, serialize writes them in that way
There was a problem hiding this comment.
I don't know how to specify in R console to enforce bigint type.
There was a problem hiding this comment.
I did some google search. R can't specify bigint type. So, we can't directly test bigint type.
We can remove the tests above, as we added schema tests and scala API tests.
felixcheung
left a comment
There was a problem hiding this comment.
I think we might need step through this a bit more?
There was a problem hiding this comment.
actually, I'm not sure.
Walking through the code, createDataFrame calls parallelize which eventually calls R's serialize. Since these big values are actually numeric, and not integer, serialize writes them in that way
There was a problem hiding this comment.
and another thing, there is no bigint in R
so I'm not sure how we would hit this path
There was a problem hiding this comment.
When specifying schema with bigint, we will hit the bigint path. Without this change, it will thrown an error of type mismatch. But as you said, we can't specify bigint type in R console.
There was a problem hiding this comment.
If R doesn't have bigint type, we should remove all bigint related logic. I don't know the history of bigint mapping in the Types.R file. Why should we have it since every big number is numeric (Double in the backend)?
There was a problem hiding this comment.
if you are referring to https://github.com/apache/spark/blob/master/R/pkg/R/types.R#L25
like it says,
names(PRIMITIVE_TYPES) are Scala types whereas values are equivalent R types.
so bigint there is Scala type, not R type
There was a problem hiding this comment.
I see. But as you mentioned, we don't know how to trigger the write path on the R side, because both bigint and double are numeric. I think we can just remove the test in the R side.
There was a problem hiding this comment.
I think this is different though, for PRIMITIVE_TYPES, it is used when you create a schema with structField in R. In this case you can definitely define a column as bigint and then pass a R numeric value to it
There was a problem hiding this comment.
When using createDataFrame, R uses serialize to send data to the backend. When taking an action, say, collect, scala side logic refers to the schema field and calls the readTypedObjects where the newly added read logic kicks in. When it returns back to R side, the newly added write logic kicks in and R side can interpret it due to the R side read logic. It seems that the write logic in R side is not called, because we don't have specific type bigint in R. Right?
There was a problem hiding this comment.
For completeness purpose, I think we can keep the write logic in R side.
SparkQA
commented
Apr 29, 2017
Test build #76306 has finished for PR 17640 at commit
|
SparkQA
commented
Apr 29, 2017
Test build #76307 has finished for PR 17640 at commit
|
jiangxb1987
commented
May 30, 2017
@wangmiao1981 Are you still working on this? |
wangmiao1981
commented
Jul 1, 2017
@jiangxb1987 The original PR has some issues that are not correctly handled. I will open a new PR when I figure out the right fix. I intended to close this PR. Thanks for closing it. |
# What changes were proposed in this pull request? This PR proposes to close stale PRs, mostly the same instances with apache#18017Closesapache#11459Closesapache#13833Closesapache#13720Closesapache#12506Closesapache#12456Closesapache#12252Closesapache#17689Closesapache#17791Closesapache#18163Closesapache#17640Closesapache#17926Closesapache#18163Closesapache#12506Closesapache#18044Closesapache#14036Closesapache#15831Closesapache#14461Closesapache#17638Closesapache#18222 Added: Closesapache#18045Closesapache#18061Closesapache#18010Closesapache#18041Closesapache#18124Closesapache#18130Closesapache#12217 Added: Closesapache#16291Closesapache#17480Closesapache#14995 Added: Closesapache#12835Closesapache#17141 ## How was this patch tested? N/A Author: hyukjinkwon <gurwls223@gmail.com> Closesapache#18223 from HyukjinKwon/close-stale-prs.
What changes were proposed in this pull request?
bigintis not supported in schema and the serialization is notDouble.Add
bigintsupport in schema and serialized and deserialized asDouble.This fix is orthogonal to the precision problem in
https://issues.apache.org/jira/browse/SPARK-12360
How was this patch tested?
Add a new unit test.