Skip to content

Commit

Permalink
Fix Arrow deserialization for FlatArray
Browse files Browse the repository at this point in the history
Tests currently fail with the latest compatible versions of this
package's dependencies because deserializing a `FlatArray` from Arrow
ends up calling a `FlatArray` constructor method that doesn't exist:
`FlatArray(vec, size)`. What it should actually call is the inner
constructor, `FlatArray{T}(vec, size)`. To fix this, we can define a
method for `fromarrow` from ArrowTypes to simply call the inner
constructor. An analogous change is not needed for `Weights` because the
method that `fromarrow` calls by default does exist in that case.

Note that no new tests were added. This is because the current tests
actually cover this case.

Co-Authored-By: Angelica Patino <[email protected]>
  • Loading branch information
ararslan and patinoam committed Nov 20, 2023
1 parent 27acd1b commit 25ca360
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LegolasFlux"
uuid = "eb5f792d-d1b1-4535-bae3-d5649ec7daa4"
authors = ["Beacon Biosignals, Inc."]
version = "0.2.2"
version = "0.2.3"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
1 change: 1 addition & 0 deletions src/LegolasFlux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Base.hash(f::FlatArray, h::UInt) = hash(:FlatArray, hash(f.vec, hash(f.size, h))
const FLATARRAY_ARROW_NAME = Symbol("JuliaLang.LegolasFlux.FlatArray")
ArrowTypes.arrowname(::Type{<:FlatArray}) = FLATARRAY_ARROW_NAME
ArrowTypes.JuliaType(::Val{FLATARRAY_ARROW_NAME}) = FlatArray
ArrowTypes.fromarrow(::Type{<:FlatArray}, vec, size) = FlatArray{eltype(vec)}(vec, size)

#####
##### `Weights`
Expand Down

0 comments on commit 25ca360

Please sign in to comment.