You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is very similar to #94 but less scary because it throws an error (and this is actually how I realized that bug existed).
using Legolas
using Legolas:@schema, @version@schema"test.issue" Issue
@version IssueV1 begin
a::Intend@schema"test.parent" Parent
@version ParentV1 begin
x::IssueV1end
table = [ParentV1(; x=IssueV1(; a=1))]
Legolas.write("issue.arrow",table, ParentV1SchemaVersion())
# New Julia sessionusing Legolas
using Legolas:@schema, @version@schema"test.issue" Issue
@version IssueV1 begin
a::Int
b::Union{Missing, Int}end@schema"test.parent" Parent
@version ParentV1 begin
x::IssueV1end
Legolas.read("issue.arrow").x[1]
which will work as long as new optional schemas are always added to the end of the list of columns (and the order doesn't change). This works by changing the signature to make those positional arguments optional, of the form a=missing, b=missing, etc. I'm not sure if that is acceptable or not, because it relies on the ordering. Xref #94
The text was updated successfully, but these errors were encountered:
to allow old parent tables to continue to validate, and update the field in the parent constructor:
@version ParentV1 begin
x::IssueV2=IssueV2(x)
end
ericphanson
changed the title
Cannot deserializing nested schema after adding optional field
Cannot deserialize nested schema after adding optional field
Jun 12, 2023
just calling out the example in the OP is "not supported" since adding the b::Union{Missing,Int} field would necessitate a version bump to Issue, and then you enter the regime described in your second comment where things work fine.
Adding b::Any without bumping the Issue version should indeed work, though. But probably a low priority bug in practice given that I doubt this use case is super common
This is very similar to #94 but less scary because it throws an error (and this is actually how I realized that bug existed).
throws
Again the issue is the
fromarrow
definition inLegolas.jl/src/schemas.jl
Line 649 in b86444c
We can change that line to
which will work as long as new optional schemas are always added to the end of the list of columns (and the order doesn't change). This works by changing the signature to make those positional arguments optional, of the form
a=missing, b=missing
, etc. I'm not sure if that is acceptable or not, because it relies on the ordering. Xref #94The text was updated successfully, but these errors were encountered: