-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support RowTables #93
Conversation
Codecov Report
@@ Coverage Diff @@
## main #93 +/- ##
==========================================
+ Coverage 98.52% 98.60% +0.07%
==========================================
Files 12 12
Lines 136 143 +7
==========================================
+ Hits 134 141 +7
Misses 2 2
Continue to review full report at Codecov.
|
0d2e038
to
00376b7
Compare
f3f40e5
to
e02dfa5
Compare
reminder to bump the project |
bf5a235
to
b6203ce
Compare
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.
Just one comment but otherwise everything is pretty straightforward and LGTM
src/apply.jl
Outdated
@@ -153,5 +171,5 @@ _postformat(::Cardinality, result, A, append_dim) = result | |||
function _postformat(::ManyToOne, result, A, append_dim) | |||
new_size = collect(size(A)) | |||
setindex!(new_size, 1, dim(A, append_dim)) | |||
return reshape(result, new_size...) | |||
return copy(reshape(result, new_size...)) # return a copy to remove the reshape type |
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.
Was the reshape type a problem before? Just wondering why we weren't already returning a copy.
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.
Yeah it was a problem because calling parent
on it later on removed the ReshapeArray
type and returned the underlying AxisArray
/ KeyedArray
(which is what we actually wanted to call parent
on). So calling copy
just performs that step in advance.
Note that we cannot call `apply!` on rowtables since the elements of the NamedTuple rows are immutable in this instance. e.g. row = NamedTuple{(:a, :b)}(a=1, b=2) convert to-from a columntable defeats the purpose as it wouldn't be mutating the underlying table.
Closes #64
Note that we cannot call
apply!
on rowtables since the elements of the NamedTuple are immutable in this instance.e.g.
Converting to-from a columntable defeats the purpose as it wouldn't be mutating the underlying data in memory.
So we just don't support it.