From b3e930dc39adadda79cd842e9d7a6c44f3b1708c Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Wed, 16 Mar 2022 14:49:58 -0500 Subject: [PATCH] hard code field options --- hack.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hack.go b/hack.go index eb1f5787b..de4ff4279 100644 --- a/hack.go +++ b/hack.go @@ -2,6 +2,7 @@ package pilosa import ( + "math" "time" "github.com/gogo/protobuf/proto" @@ -48,14 +49,6 @@ func UnmarshalFieldOptions(name string, createdAt int64, buf []byte) (*FieldInfo } fi.Options.CacheType = pbi.CacheType fi.Options.CacheSize = pbi.CacheSize - fi.Options.Min = pql.Decimal{ - Value: pbi.OldMin, - Scale: 3, //what scale? - } - fi.Options.Max = pql.Decimal{ - Value: pbi.OldMax, - Scale: 3, //what scale? its 3 - } fi.Options.Base = pbi.Base fi.Options.BitDepth = pbi.BitDepth fi.Options.TimeQuantum = TimeQuantum(pbi.TimeQuantum) @@ -67,5 +60,22 @@ func UnmarshalFieldOptions(name string, createdAt int64, buf []byte) (*FieldInfo fi.Options.Keys = pbi.Keys fi.Options.NoStandardView = pbi.NoStandardView + // hard code for the unmarshal go broken with a version change + switch fi.Options.Type { + case "int": + min := int64(math.MinInt64) + max := int64(math.MaxInt64) + fi.Options.Min = pql.NewDecimal(min, 0) + fi.Options.Max = pql.NewDecimal(max, 0) + fi.Options.Base = 0 + case "decimal": + scale := int64(3) + min, max := pql.MinMax(scale) + fi.Options.Min = min + fi.Options.Max = max + fi.Options.Base = 0 + fi.Options.Scale = scale + } + return fi, nil }