improved support for struct columns with missing values#498
improved support for struct columns with missing values#498baumgold wants to merge 1 commit intoapache:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #498 +/- ##
==========================================
+ Coverage 87.34% 87.36% +0.01%
==========================================
Files 26 26
Lines 3288 3292 +4
==========================================
+ Hits 2872 2876 +4
Misses 416 416 ☔ View full report in Codecov by Sentry. |
0fa25e5 to
78e22be
Compare
|
@quinnj / @ericphanson - Any questions/comments/concerns here? If not I'd like to merge and release. Thanks. |
| ToStruct(x::A, j::Integer) where {A} = | ||
| ToStruct{fieldtype(Base.nonmissingtype(eltype(A)), j),j,A}(x) | ||
| function ToStruct(x::A, j::Integer, hasmissing::Bool=false) where {A} | ||
| AT = fieldtype(eltype(A), j) |
There was a problem hiding this comment.
do we still want Base.nonmissingtype(eltype(A)) inside the field type?
There was a problem hiding this comment.
I don't think so. My change makes it so missing types are properly supported.
|
I don't really know this code well enough to be confident here. But one thing I can say is it's probably good if the PR adds a test that is failing on main, to show precisely what has been fixed (and prevent regressions) |
The current implementation depends on
Arrow.defaultreturning a sentinel object when the value is missing. This usually works, but occasionally has problems. This PR simplifies the implementation and solves some of the problematic corner-cases.One example of a problematic corner-case is a column of lists of structs:
It's possible that users may wrap this Vector in a
SubArray. In this caseArrow.default(::Type{<:SubArray })actually usesArrow.default(::Type{<:AbstractVector})which enforces that the parent-type is aVector- this is not always the case. For example, the parent may well be of typeArrow.Structif the data being written was also read from an Arrow file. Certainly we could enhanceArrow.defaultto return a proper type for SubArray but simpler is to remove the dependency onArrow.defaultfromToStruct.