From a3169601a51d4332a96018bf1d64c668f40c3997 Mon Sep 17 00:00:00 2001 From: Arijit Das Date: Wed, 25 Mar 2020 16:03:43 +0530 Subject: [PATCH] Set correct posting list type while creating it in live loader. (#5012) * Fix live loader data conversion for conflict key generation. --- dgraph/cmd/live/batch.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dgraph/cmd/live/batch.go b/dgraph/cmd/live/batch.go index f30c0881551..0b70579b57d 100644 --- a/dgraph/cmd/live/batch.go +++ b/dgraph/cmd/live/batch.go @@ -191,6 +191,7 @@ func getTypeVal(val *api.Value) (types.Val, error) { } p1.Value = p1.Value.([]byte) + p1.Tid = p.Tid return p1, nil } @@ -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())