diff --git a/attr.go b/attr.go index a9eab184c..30365769c 100644 --- a/attr.go +++ b/attr.go @@ -108,8 +108,14 @@ func (s *AttrStore) SetAttrs(id uint64, m map[string]interface{}) error { for k, v := range m { if v == nil { delete(attr, k) - } else { + continue + } + + switch v := v.(type) { + case string, uint64, bool: attr[k] = v + default: + return fmt.Errorf("invalid attr type: %T", v) } } diff --git a/internal/internal.proto b/internal/internal.proto index 31f8688aa..3fe5b6b83 100644 --- a/internal/internal.proto +++ b/internal/internal.proto @@ -28,7 +28,7 @@ message Profile { message Attr { required string Key = 1; optional string StringValue = 2; - optional uint64 UintValue = 3; + optional uint64 UintValue = 3; optional bool BoolValue = 4; } diff --git a/pql/parser.go b/pql/parser.go index 824467103..5f7025121 100644 --- a/pql/parser.go +++ b/pql/parser.go @@ -390,7 +390,7 @@ func (p *Parser) parseSetBitmapAttrsCall() (*SetBitmapAttrs, error) { case string, bool: c.Attrs[key] = v case uint64: - c.Attrs[key] = int64(v) + c.Attrs[key] = v default: return nil, parseErrorf(pos, "invalid SetBitmapAttrs() arg: %v", arg.key) }