Skip to content

Commit

Permalink
Various serialization fixes. (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmettokgoz authored and yuce committed Feb 9, 2023
1 parent f7c6247 commit 23a45ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aggregate/aggregate_distinct.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func (a aggDistinct) ClassID() (classID int32) {
func (a aggDistinct) WriteData(output serialization.DataOutput) {
writeAttrPath(output, a.attrPath)
// member side field, not used in client
output.WriteInt64(0)
output.WriteInt32(0)
}

func (a *aggDistinct) ReadData(input serialization.DataInput) {
a.attrPath = input.ReadString()
// member side field, not used in client
input.ReadInt64()
input.ReadInt32()
}

func (a aggDistinct) String() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/serialization/default_portable_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (pw *DefaultPortableWriter) GetRawDataOutput() serialization.DataOutput {
pw.output.PWriteInt32(pw.offset+index*Int32SizeInBytes, pos)
pw.raw = true
}
return pw.output.ObjectDataOutput
return pw.output
}

func (pw *DefaultPortableWriter) End() {
Expand Down
4 changes: 4 additions & 0 deletions internal/serialization/object_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ func NewPositionalObjectDataOutput(length int, service *Service, bigEndian bool)
return &PositionalObjectDataOutput{NewObjectDataOutput(length, service, bigEndian)}
}

func (p *PositionalObjectDataOutput) WriteObject(object interface{}) {
p.service.WriteObject(p, object)
}

func (p *PositionalObjectDataOutput) PWriteByte(pos int32, v byte) {
p.buffer[pos] = v
}
Expand Down
3 changes: 3 additions & 0 deletions internal/serialization/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (s *Service) ToData(object interface{}) (r Data, err error) {
err = makeError(rec)
}
}()
if object == nil {
return nil, nil
}
if serData, ok := object.(Data); ok {
return serData, nil
}
Expand Down

0 comments on commit 23a45ba

Please sign in to comment.