Skip to content

Commit 74979b8

Browse files
committed
rm legacy unpackFct tags and varOr
1 parent 5c9e8cf commit 74979b8

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

src/services/Serialization.jl

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -379,22 +379,33 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any}) where G <: Abstrac
379379
# Parse it
380380
timestamp = ZonedDateTime(packedProps["timestamp"])
381381
nstime = Nanosecond(get(packedProps, "nstime", 0))
382-
if packedProps["tags"] isa String
383-
tags = JSON2.read(packedProps["tags"], Vector{Symbol})
384-
else
385-
tags = Symbol.(packedProps["tags"])
386-
# If tags is empty we need to make sure it's a Vector{Symbol}
387-
if length(tags) == 0
388-
tags = Vector{Symbol}()
389-
end
390-
end
391-
392-
# Get the stored variable order
393-
_variableOrderSymbols = if packedProps["_variableOrderSymbols"] isa String
394-
JSON2.read(packedProps["_variableOrderSymbols"], Vector{Symbol})
395-
else
396-
Symbol.(packedProps["_variableOrderSymbols"])
397-
end
382+
383+
_vecSymbol(vecstr) = Symbol[map(x->Symbol(x),vecstr)...]
384+
385+
# Get the stored tags and variable order
386+
@assert !(packedProps["tags"] isa String) "unpackFactor expecting JSON only data, packed `tags` should be a vector of strings (not a single string of elements)."
387+
@assert !(packedProps["_variableOrderSymbols"] isa String) "unpackFactor expecting JSON only data, packed `_variableOrderSymbols` should be a vector of strings (not a single string of elements)."
388+
tags = _vecSymbol(packedProps["tags"])
389+
_variableOrderSymbols = _vecSymbol(packedProps["_variableOrderSymbols"])
390+
# if packedProps["tags"] isa String
391+
# # TODO, legacy and should be removed
392+
# tags = JSON2.read(packedProps["tags"], Vector{Symbol})
393+
# else
394+
# # the preferred (and should be only) solution
395+
# tags = Symbol.(packedProps["tags"])
396+
# # If tags is empty we need to make sure it's a Vector{Symbol}
397+
# if length(tags) == 0
398+
# tags = Vector{Symbol}()
399+
# end
400+
# end
401+
# # Get the stored variable order
402+
# _variableOrderSymbols = if packedProps["_variableOrderSymbols"] isa String
403+
# # TODO, legacy and should be removed
404+
# JSON2.read(packedProps["_variableOrderSymbols"], Vector{Symbol})
405+
# else
406+
# # the preferred (and should be only) solution
407+
# Symbol.(packedProps["_variableOrderSymbols"])
408+
# end
398409

399410
data = packedProps["data"]
400411
datatype = packedProps["fnctype"]

0 commit comments

Comments
 (0)