From 6b4fde77fd28cea7a2691360acb5e945cf6956f4 Mon Sep 17 00:00:00 2001 From: Aiee <18348405+Aiee@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:28:56 +0800 Subject: [PATCH 1/2] Fix timezone in path --- client_test.go | 28 +++++++++++++++++++++++ nebula-docker-compose/docker-compose.yaml | 20 ++++++++-------- result_set.go | 1 + value_wrapper.go | 2 +- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/client_test.go b/client_test.go index 1b2546c1..d7c6a71f 100644 --- a/client_test.go +++ b/client_test.go @@ -509,6 +509,34 @@ func TestServiceDataIO(t *testing.T) { assert.Equal(t, expected, *localTime) } + // Test path + { + resp, err := tryToExecute(session, "MATCH p = (:person{name: \"Bob\"}) -[e:friend]-> (:person{name: \"Lily\"}) RETURN p") + if err != nil { + t.Fatalf(err.Error()) + return + } + assert.Equal(t, 1, resp.GetRowSize()) + record, err := resp.GetRowValuesByIndex(0) + if err != nil { + t.Fatalf(err.Error()) + return + } + valWrap, err := record.GetValueByIndex(0) + if err != nil { + t.Fatalf(err.Error()) + return + } + path, err := valWrap.AsPath() + if err != nil { + t.Fatalf(err.Error()) + return + } + assert.Equal(t, + "<(\"Bob\" :student{interval: P1MT100.000020000S, name: \"Bob\"} :person{age: 10, birthday: 2010-09-10T10:08:02.000000, book_num: 100, child_name: \"Hello Worl\", expend: 100.0, first_out_city: 1111, friends: 10, grade: 3, hobby: __NULL__, is_girl: false, morning: 07:10:00.000000, name: \"Bob\", property: 1000.0, start_school: 2017-09-10})-[:friend@0 {end_Datetime: 2010-09-10T10:08:02.000000, start_Datetime: 2008-09-10T10:08:02.000000}]->(\"Lily\" :student{interval: P12MT0.000000000S, name: \"Lily\"} :person{age: 9, birthday: 2010-09-10T10:08:02.000000, book_num: 100, child_name: \"Hello Worl\", expend: 100.0, first_out_city: 1111, friends: 10, grade: 3, hobby: __NULL__, is_girl: false, morning: 07:10:00.000000, name: \"Lily\", property: 1000.0, start_school: 2017-09-10})>", + path.String()) + } + // Check timestamp { // test show jobs diff --git a/nebula-docker-compose/docker-compose.yaml b/nebula-docker-compose/docker-compose.yaml index 99dcf7e6..eeb8fa7f 100644 --- a/nebula-docker-compose/docker-compose.yaml +++ b/nebula-docker-compose/docker-compose.yaml @@ -1,7 +1,7 @@ version: '3.4' services: metad0: - image: vesoft/nebula-metad:nightly + image: vesoft/nebula-metad:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -44,7 +44,7 @@ services: - SYS_PTRACE metad1: - image: vesoft/nebula-metad:nightly + image: vesoft/nebula-metad:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -87,7 +87,7 @@ services: - SYS_PTRACE metad2: - image: vesoft/nebula-metad:nightly + image: vesoft/nebula-metad:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -130,7 +130,7 @@ services: - SYS_PTRACE storaged0: - image: vesoft/nebula-storaged:nightly + image: vesoft/nebula-storaged:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -177,7 +177,7 @@ services: - SYS_PTRACE storaged1: - image: vesoft/nebula-storaged:nightly + image: vesoft/nebula-storaged:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -224,7 +224,7 @@ services: - SYS_PTRACE storaged2: - image: vesoft/nebula-storaged:nightly + image: vesoft/nebula-storaged:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -271,7 +271,7 @@ services: - SYS_PTRACE graphd: - image: vesoft/nebula-graphd:nightly + image: vesoft/nebula-graphd:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -318,7 +318,7 @@ services: - SYS_PTRACE graphd1: - image: vesoft/nebula-graphd:nightly + image: vesoft/nebula-graphd:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -365,7 +365,7 @@ services: - SYS_PTRACE graphd2: - image: vesoft/nebula-graphd:nightly + image: vesoft/nebula-graphd:v3.4.0 environment: USER: root TZ: "${TZ}" @@ -414,7 +414,7 @@ services: - SYS_PTRACE console: - image: vesoft/nebula-console:nightly + image: vesoft/nebula-console:v3.4.0 entrypoint: "" command: - sh diff --git a/result_set.go b/result_set.go index a3eae91b..eaa0669f 100644 --- a/result_set.go +++ b/result_set.go @@ -238,6 +238,7 @@ func genPathWrapper(path *nebula.Path, timezoneInfo timezoneInfo) (*PathWrapper, nodeList: nodeList, relationshipList: relationshipList, segments: segList, + timezoneInfo: timezoneInfo, }, nil } diff --git a/value_wrapper.go b/value_wrapper.go index 069bd415..8b3a2b31 100644 --- a/value_wrapper.go +++ b/value_wrapper.go @@ -301,7 +301,7 @@ func (valWrap ValueWrapper) GetType() string { // // Maps in the output will be sorted by key value in alphabetical order. // -// For vetex, the output is in form (vid: tagName{propKey: propVal, propKey2, propVal2}), +// For vertex, the output is in form (vid: tagName{propKey: propVal, propKey2, propVal2}), // For edge, the output is in form (SrcVid)-[name]->(DstVid)@Ranking{prop1: val1, prop2: val2} // where arrow direction depends on edgeType. // For path, the output is in form (v1)-[name@edgeRanking]->(v2)-[name@edgeRanking]->(v3) From 66b5a30bfda7e6ffe2e163908b25c3a4d4c9ec9e Mon Sep 17 00:00:00 2001 From: Aiee <18348405+Aiee@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:32:25 +0800 Subject: [PATCH 2/2] Fix typo --- nebula-docker-compose/docker-compose.yaml | 20 ++++++++++---------- result_set.go | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nebula-docker-compose/docker-compose.yaml b/nebula-docker-compose/docker-compose.yaml index eeb8fa7f..99dcf7e6 100644 --- a/nebula-docker-compose/docker-compose.yaml +++ b/nebula-docker-compose/docker-compose.yaml @@ -1,7 +1,7 @@ version: '3.4' services: metad0: - image: vesoft/nebula-metad:v3.4.0 + image: vesoft/nebula-metad:nightly environment: USER: root TZ: "${TZ}" @@ -44,7 +44,7 @@ services: - SYS_PTRACE metad1: - image: vesoft/nebula-metad:v3.4.0 + image: vesoft/nebula-metad:nightly environment: USER: root TZ: "${TZ}" @@ -87,7 +87,7 @@ services: - SYS_PTRACE metad2: - image: vesoft/nebula-metad:v3.4.0 + image: vesoft/nebula-metad:nightly environment: USER: root TZ: "${TZ}" @@ -130,7 +130,7 @@ services: - SYS_PTRACE storaged0: - image: vesoft/nebula-storaged:v3.4.0 + image: vesoft/nebula-storaged:nightly environment: USER: root TZ: "${TZ}" @@ -177,7 +177,7 @@ services: - SYS_PTRACE storaged1: - image: vesoft/nebula-storaged:v3.4.0 + image: vesoft/nebula-storaged:nightly environment: USER: root TZ: "${TZ}" @@ -224,7 +224,7 @@ services: - SYS_PTRACE storaged2: - image: vesoft/nebula-storaged:v3.4.0 + image: vesoft/nebula-storaged:nightly environment: USER: root TZ: "${TZ}" @@ -271,7 +271,7 @@ services: - SYS_PTRACE graphd: - image: vesoft/nebula-graphd:v3.4.0 + image: vesoft/nebula-graphd:nightly environment: USER: root TZ: "${TZ}" @@ -318,7 +318,7 @@ services: - SYS_PTRACE graphd1: - image: vesoft/nebula-graphd:v3.4.0 + image: vesoft/nebula-graphd:nightly environment: USER: root TZ: "${TZ}" @@ -365,7 +365,7 @@ services: - SYS_PTRACE graphd2: - image: vesoft/nebula-graphd:v3.4.0 + image: vesoft/nebula-graphd:nightly environment: USER: root TZ: "${TZ}" @@ -414,7 +414,7 @@ services: - SYS_PTRACE console: - image: vesoft/nebula-console:v3.4.0 + image: vesoft/nebula-console:nightly entrypoint: "" command: - sh diff --git a/result_set.go b/result_set.go index eaa0669f..6588bcd5 100644 --- a/result_set.go +++ b/result_set.go @@ -461,7 +461,7 @@ func (node Node) Properties(tagName string) (map[string]*ValueWrapper, error) { kvMap := make(map[string]*ValueWrapper) // Check if label exists if !node.HasTag(tagName) { - return nil, fmt.Errorf("failed to get properties: Tag name %s does not exsist in the Node", tagName) + return nil, fmt.Errorf("failed to get properties: Tag name %s does not exist in the Node", tagName) } index := node.tagNameIndexMap[tagName] for k, v := range node.vertex.Tags[index].Props { @@ -473,7 +473,7 @@ func (node Node) Properties(tagName string) (map[string]*ValueWrapper, error) { // Keys returns all prop names of the given tag name func (node Node) Keys(tagName string) ([]string, error) { if !node.HasTag(tagName) { - return nil, fmt.Errorf("failed to get properties: Tag name %s does not exsist in the Node", tagName) + return nil, fmt.Errorf("failed to get properties: Tag name %s does not exist in the Node", tagName) } var propNameList []string index := node.tagNameIndexMap[tagName] @@ -486,7 +486,7 @@ func (node Node) Keys(tagName string) ([]string, error) { // Values returns all prop values of the given tag name func (node Node) Values(tagName string) ([]*ValueWrapper, error) { if !node.HasTag(tagName) { - return nil, fmt.Errorf("failed to get properties: Tag name %s does not exsist in the Node", tagName) + return nil, fmt.Errorf("failed to get properties: Tag name %s does not exist in the Node", tagName) } var propValList []*ValueWrapper index := node.tagNameIndexMap[tagName]