From f93c5d0ab5299f137c1695799105ff5d682ab3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Llor=C3=A0?= Date: Thu, 18 Feb 2016 14:50:15 -0800 Subject: [PATCH] Fix to the GUID stability issue introduced by anchors Fixed the stability issued that introduced comparison errors. Closes #36 and also introduce new tests to validate the behavior. --- bql/planner/data_access.go | 1 - triple/triple.go | 2 +- triple/triple_test.go | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/bql/planner/data_access.go b/bql/planner/data_access.go index 2ebf6ba1..10d766ca 100644 --- a/bql/planner/data_access.go +++ b/bql/planner/data_access.go @@ -336,7 +336,6 @@ func simpleFetch(ctx context.Context, gs []storage.Graph, cls *semantic.GraphCla aErr error wg sync.WaitGroup ) - wg.Add(2) ts := make(chan *triple.Triple, chanSize) go func() { diff --git a/triple/triple.go b/triple/triple.go index 752d5548..c4b1f356 100644 --- a/triple/triple.go +++ b/triple/triple.go @@ -276,7 +276,7 @@ func (t *Triple) GUID() string { // Object. if t.o.p == nil { - buffer.WriteString(t.o.p.String()) + buffer.WriteString(t.o.String()) } else { ta, err := t.o.p.TimeAnchor() if err != nil { diff --git a/triple/triple_test.go b/triple/triple_test.go index 19d46b45..b1510841 100644 --- a/triple/triple_test.go +++ b/triple/triple_test.go @@ -101,7 +101,43 @@ func TestGUID(t *testing.T) { }{ { "/some/type\t\"foo\"@[]\t/some/type", - "/some/type\t\"foo\"@[]\t\"bar\"@[]", + "/some/type\t\"foo\"@[]\t/some/type", + }, + { + "/some/type\t\"foo\"@[2015-01-01T00:00:00-09:00]\t/some/type", + "/some/type\t\"foo\"@[2015-01-01T00:00:00-09:00]\t/some/type", + }, + { + "/some/type\t\"foo\"@[2015-01-01T00:00:00-09:00]\t/some/type", + "/some/type\t\"foo\"@[2015-01-01T01:00:00-08:00]\t/some/type", + }, + { + "/some/type\t\"foo\"@[]\t\"bar\"@[2015-01-01T00:00:00-09:00]", + "/some/type\t\"foo\"@[]\t\"bar\"@[2015-01-01T00:00:00-09:00]", + }, + { + "/some/type\t\"foo\"@[]\t\"bar\"@[2015-01-01T00:00:00-09:00]", + "/some/type\t\"foo\"@[]\t\"bar\"@[2015-01-01T01:00:00-08:00]", + }, + { + "/some/type\t\"foo\"@[]\t\"true\"^^type:bool", + "/some/type\t\"foo\"@[]\t\"true\"^^type:bool", + }, + { + "/some/type\t\"foo\"@[]\t\"1\"^^type:int64", + "/some/type\t\"foo\"@[]\t\"1\"^^type:int64", + }, + { + "/some/type\t\"foo\"@[]\t\"1\"^^type:float64", + "/some/type\t\"foo\"@[]\t\"1\"^^type:float64", + }, + { + "/some/type\t\"foo\"@[]\t\"text\"^^type:text", + "/some/type\t\"foo\"@[]\t\"text\"^^type:text", + }, + { + "/some/type\t\"foo\"@[]\t\"[0 0 0]\"^^type:blob", + "/some/type\t\"foo\"@[]\t\"[0 0 0]\"^^type:blob", }, } for _, entry := range testTable {