diff --git a/query/query.go b/query/query.go index 30d5f9c37812ce7b61ab733d57a2bd544ec9c099..83a869726119751bdcb35c4f9f3a7dfaff1855ba 100644 --- a/query/query.go +++ b/query/query.go @@ -327,21 +327,12 @@ func (g *SubGraph) preTraverse(uid uint64, dst *graph.Node) error { return fmt.Errorf("While parsing value") } - var ival interface{} - if err := posting.ParseValue(&ival, tv.ValBytes()); err != nil { - return err - } - - if ival == nil { - ival = "" - } - - v := ival.(string) + v := tv.ValBytes() if pc.Attr == "_xid_" { - dst.Xid = v + dst.Xid = string(v) } else { - p := &graph.Property{Prop: pc.Attr, Val: []byte(v)} + p := &graph.Property{Prop: pc.Attr, Val: v} properties = append(properties, p) } diff --git a/query/query_test.go b/query/query_test.go index 9805a7c3e6785d19a54745ac90debf5703f7d79f..5450abf16a7464c46d0b1470e87fa1657da4c778 100644 --- a/query/query_test.go +++ b/query/query_test.go @@ -383,14 +383,14 @@ func TestToPB(t *testing.T) { if gr.Uid != 1 { t.Errorf("Expected uid 1, Got: %v", gr.Uid) } - if gr.Xid != "mich" { + if gr.Xid != `"mich"` { t.Errorf("Expected xid mich, Got: %v", gr.Xid) } if len(gr.Properties) != 3 { t.Errorf("Expected values map to contain 3 properties, Got: %v", len(gr.Properties)) } - if string(getProperty(gr.Properties, "name")) != "Michonne" { + if string(getProperty(gr.Properties, "name")) != `"Michonne"` { t.Errorf("Expected property name to have value Michonne, Got: %v", string(getProperty(gr.Properties, "name"))) } @@ -409,7 +409,7 @@ func TestToPB(t *testing.T) { t.Errorf("Expected values map to contain 1 property, Got: %v", len(child.Properties)) } - if string(getProperty(child.Properties, "name")) != "Rick Grimes" { + if string(getProperty(child.Properties, "name")) != `"Rick Grimes"` { t.Errorf("Expected property name to have value Rick Grimes, Got: %v", string(getProperty(child.Properties, "name"))) }