环境信息
- nebula 版本:2.0.0-rc1
- 部署方式:物理集群(metad*1, graphd*1, storaged*3)
问题的具体描述:计算某个节点上游所有节点某个属性的 sum 值,作为该节点的属性值
示例:
# create space
CREATE SPACE `testing` (partition_num = 10, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(8))
# create tags & edges
CREATE TAG tagC(idInt int, name string, weight double);
CREATE TAG tagA(idInt int, name string, total_weight double default 0.0);
CREATE TAG INDEX index_tagA_name on tagA(name(16));
CREATE EDGE edgeAC();
# insert vertex & edge
insert vertex tagA(idInt, name) values "A":(1,"A")
insert vertex tagA(idInt, name) values "AA":(2,"AA")
insert vertex tagA(idInt, name) values "AAA":(3,"AAA")
insert vertex tagC(idInt, name, weight) values "1":(1,"v1", 1.11)
insert vertex tagC(idInt, name, weight) values "2":(2,"v1", 1.11)
insert edge edgeAC() values "A"->"1":()
insert edge edgeAC() values "1"->"AA":()
insert edge edgeAC() values "AA"->"2":()
insert edge edgeAC() values "2"->"AAA":()
如上所述,构建了关系图:A → 1 → AA → 2 → AAA
目标:将 “1”, “2” 结点 tagC 的 weight
属性作 sum,作为 “AAA” 结点 tagA 的 total_weight
属性的值
请教:
-
如何将上游节点的 sum 值计算出来?尝试了利用
sum
和reduce
函数,没有得到预期结果;
-
查询出 sum 值后,如何直接更新到对应结点的属性值中,以上述为例:更新到 “AAA” 结点的 tagA 的
total_weight
属性值中?