Skip to content
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

Serialization issue when using missing #108

Open
slwu89 opened this issue Jan 29, 2024 · 1 comment
Open

Serialization issue when using missing #108

slwu89 opened this issue Jan 29, 2024 · 1 comment
Assignees

Comments

@slwu89
Copy link
Member

slwu89 commented Jan 29, 2024

The following round-trip serialization has an error when reading the data back in. The error is ERROR: MethodError: no method matching Union{Missing, String}(::String).

using Catlab

@present SimpleSch(FreeSchema) begin
    X::Ob
    Attr1::AttrType
    attr::Attr(X,Attr1)
end

@acset_type SimpleData(SimpleSch)

simple_data = @acset SimpleData{Union{String,Missing}} begin
    X=3
    attr=["a",missing,"c"]
end

write_json_acset_schema(SimpleSch, "./simplesch.json")
write_json_acset(simple_data, "./simpledata.json")

SimpleSch1 = read_json_acset_schema("./simplesch.json")

@acset_type SimpleData1(SimpleSch1)

simple_data1 = read_json_acset(SimpleData1{Union{String,Missing}}, "./simpledata.json")

On versions

  [227ef7b5] ACSets v0.2.13
  [134e5e36] Catlab v0.16.5
@olynch olynch self-assigned this Feb 7, 2024
@slwu89
Copy link
Member Author

slwu89 commented Jul 11, 2024

@olynch or @epatters do you have any ideas on how we could address this? The issue is when parsing the json acset we hit these methods in StructTypes https://github.com/JuliaData/StructTypes.jl/blob/main/src/StructTypes.jl#L524-L526 and it tries to call Union{String,Missing}(). Once again, union types being a source of strange behavior in Julia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants