-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-42692][CONNECT] Implement Dataset.toJSON
#40319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Dataset.toJSON
|
|
||
| def toJSON: Dataset[String] = { | ||
| throw new UnsupportedOperationException("toJSON is not implemented.") | ||
| sparkSession.newDataset(StringEncoder) { builder => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this better over project(to_json(col(*))).as(StringEncoder)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry ... what is project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, I mean select...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks . Sorry I didn't understand what project is before ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
|
||
| test("toJSON") { | ||
| val expected = Array( | ||
| "{\"b\":0.0,\"id\":0,\"d\":\"world\",\"a\":0}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use raw strings here. That is easier to read.
val expected = Array(
"""{"b":0.0,"id":0,"d":"world","a":0}""",
...
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
hvanhovell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LGTM |
### What changes were proposed in this pull request? This pr aims to implement Dataset.toJSON. ### Why are the changes needed? Add Spark connect jvm client api coverage. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? - Add new test - Manually checked Scala 2.13 Closes #40319 from LuciferYang/SPARK-42692. Authored-by: yangjie01 <[email protected]> Signed-off-by: Herman van Hovell <[email protected]> (cherry picked from commit 51504e4) Signed-off-by: Herman van Hovell <[email protected]>
|
Thanks @hvanhovell @amaliujia |
### What changes were proposed in this pull request? This pr aims to implement Dataset.toJSON. ### Why are the changes needed? Add Spark connect jvm client api coverage. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? - Add new test - Manually checked Scala 2.13 Closes apache#40319 from LuciferYang/SPARK-42692. Authored-by: yangjie01 <[email protected]> Signed-off-by: Herman van Hovell <[email protected]> (cherry picked from commit 51504e4) Signed-off-by: Herman van Hovell <[email protected]>
What changes were proposed in this pull request?
This pr aims to implement Dataset.toJSON.
Why are the changes needed?
Add Spark connect jvm client api coverage.
Does this PR introduce any user-facing change?
No
How was this patch tested?