-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-1207: [C++] Implement MapArray, MapBuilder, MapType classes, and IPC support #4352
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
|
Will review this when I can. Should we try to inherit |
59bb5e0 to
d62efcf
Compare
|
@bkietz You should be able to fix the Travis-CI failures by rebasing from master. |
64fdad9 to
ac878bb
Compare
Codecov Report
@@ Coverage Diff @@
## master #4352 +/- ##
==========================================
+ Coverage 88.41% 89.26% +0.84%
==========================================
Files 784 639 -145
Lines 100266 89293 -10973
Branches 1251 0 -1251
==========================================
- Hits 88651 79705 -8946
+ Misses 11379 9588 -1791
+ Partials 236 0 -236
Continue to review full report at Codecov.
|
|
@pitrou rebased and green |
pitrou
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.
Thanks @bkietz . A couple more comments below.
cpp/src/arrow/type-test.cc
Outdated
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.
"keys_sorted=true" perhaps?
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.
If you prefer
ac878bb to
45895f3
Compare
no tests yet
80d69bc to
9fb8700
Compare
pitrou
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 now, but see question about the type layout definition.
| if (children.size() != 1) { | ||
| return Status::Invalid("Map must have exactly 1 child field"); | ||
| } | ||
| if ( // FIXME(bkietz) temporarily disabled: this field is sometimes read nullable |
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.
Do you know where the issue lies?
|
@pitrou This allows MapArray to be a specialization of ListArray, with corresponding reuse of code (comparison, for example) |
|
Null pairs are disallowed with DCHECKs, and neither MapBuilder nor ArrayFromJSON will produce a MapArray with a null pair. |
|
Thanks. I was just curious. Since the definition was already in the format spec, I won't object :-) |
|
This is a nice step forward. @bkietz is there a JIRA open for the integration issue? If not, can you open one? |
|
@BryanCutler merged JIRA for integration tests: https://issues.apache.org/jira/browse/ARROW-1279 |
|
Nice! The Java MapVector is merged also, so I think we can just enable the integration test and hope for green :) |
|
Well, I got the integration tests running and there was only 1 error! |

Implements
MapArrayas a subclass ofListArray, where eachvaluein the list is akey: itempair. (This naming is not the most natural, butvalueis taken.)MapType::keys_sorted()is currently stored but unused- for exampleMapBuilderdoes not check inserted keys for correct ordering.MapTypeis printed asmap<utf8, int32>andmap<int32, float64, keys_sorted>for unsorted, sorted keys respectively.Map arrays are created with
ArrayFromJSONby providing for each pair an array of length 2 containing the key and the mapped item (example).