-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11743][SQL] Add UserDefinedType support to RowEncoder #9712
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2721741
Add UserDefinedType support to RowEncoder.
viirya bab5c5b
Fix scala style.
viirya db644fb
Add arrayOfUDT.
viirya 99867ad
Merge remote-tracking branch 'upstream/master' into rowencoder-udt
viirya a5fdbce
Merge the branches of ArrayType.
viirya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add arrayOfUDT.
- Loading branch information
commit db644fb2be3a3fd32f7f62993575dc6d8cef594e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,7 @@ class RowEncoderSuite extends SparkFunSuite { | |
| private val structOfUDT = new StructType().add("udt", new ExamplePointUDT, false) | ||
| private val arrayOfString = ArrayType(StringType) | ||
| private val mapOfString = MapType(StringType, StringType) | ||
| private val arrayOfUDT = ArrayType(new ExamplePointUDT, false) | ||
|
|
||
| encodeDecodeTest( | ||
| new StructType() | ||
|
|
@@ -119,6 +120,18 @@ class RowEncoderSuite extends SparkFunSuite { | |
| new StructType().add("array", arrayOfString).add("map", mapOfString)) | ||
| .add("structOfUDT", structOfUDT)) | ||
|
|
||
| test(s"encode/decode: arrayOfUDT") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any reason why we put this test here instead of adding
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I moved it in #10538. |
||
| val schema = new StructType() | ||
| .add("arrayOfUDT", arrayOfUDT) | ||
|
|
||
| val encoder = RowEncoder(schema) | ||
|
|
||
| val input: Row = Row(Seq(new ExamplePoint(0.1, 0.2), new ExamplePoint(0.3, 0.4))) | ||
| val row = encoder.toRow(input) | ||
| val convertedBack = encoder.fromRow(row) | ||
| assert(input.getSeq[ExamplePoint](0) == convertedBack.getSeq[ExamplePoint](0)) | ||
| } | ||
|
|
||
| test(s"encode/decode: Product") { | ||
| val schema = new StructType() | ||
| .add("structAsProduct", | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we merge these branches together?
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.
yes. updated.