Skip to content

Commit

Permalink
Set correct posting list type while creating it in live loader. (#5012)
Browse files Browse the repository at this point in the history
* Fix live loader data conversion for conflict key generation.
  • Loading branch information
Arijit Das authored and danielmai committed Apr 24, 2020
1 parent d8e3b64 commit a316960
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions dgraph/cmd/live/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func getTypeVal(val *api.Value) (types.Val, error) {
}

p1.Value = p1.Value.([]byte)
p1.Tid = p.Tid
return p1, nil
}

Expand Down Expand Up @@ -301,11 +302,7 @@ func (l *loader) conflictKeysForNQuad(nq *api.NQuad) ([]uint64, error) {
Tid: types.TypeID(de.GetValueType()),
Value: de.GetValue(),
}
// If the value type is not already set according to the schema, set it to string and
// then convert it to the type as declared in the schema.
if storageVal.Tid != pred.ValueType {
storageVal.Tid = types.StringID
}

schemaVal, err := types.Convert(storageVal, types.TypeID(pred.ValueType))
if err != nil {
errs = append(errs, err.Error())
Expand Down

0 comments on commit a316960

Please sign in to comment.