nebula cypher改写

我们原有的cypher是这样的,怎么改成nebula cypher呢
match (m:USER {mobileId:'1bb7d145a19749a9e1b1f12dc613233115d5df3e22c741309ea12e71256d03d6'})
optional match (m)-[r1:CALL_TO]-(x:MOBILE)-[:APPLY_FOR]->(a1:APPL)-[:APPLY_ON]-(t1:TIME)
where r1.first_callmark_on<=20220602 and replace(t1.date,'-','')<='20220602'
with m,collect(distinct x) as col_appl_1st_v4

unwind case when col_appl_1st_v4 =[] then [null] else col_appl_1st_v4 end as x
optional match (x)-[r2:CALL_TO]-(n:USER) where r2.first_callmark_on<=20220602 and not (m=n)
with m,col_appl_1st_v4,collect(distinct n) as col_user_2nd_v4
with m,col_appl_1st_v4,col_user_2nd_v4,filter(n in col_user_2nd_v4 where "MOBILE" in labels(n)) as col_mobile_2nd_v4

unwind case when col_mobile_2nd_v4 =[] then [null] else col_mobile_2nd_v4 end as n
optional match (n)<-[r3:CBK_STATE_ENTERPRISE_LEADER]-(y:USER) where r3.first_cbkmark_on<=20220602 and not (y=n)
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,
count(distinct case when y is not null then n else null end) as n_cbkin_State_enterprise_leader_2nd_v4

unwind case when col_mobile_2nd_v4 =[] then [null] else col_mobile_2nd_v4 end as n
optional match (n)<-[r3:CBK_ENGINEER]-(y:USER) where r3.first_cbkmark_on<=20220602 and not (y=n)
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,
count(distinct case when y is not null then n else null end) as n_cbkin_Engineer_2nd_v4

unwind case when col_mobile_2nd_v4 =[] then [null] else col_mobile_2nd_v4 end as n
optional match (n:MOBILE)-[:APPLY_FOR]->(a2:APPL)-[:APPLY_ON]->(t2:TIME) where replace(t2.date,'-','')<='20220602'
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,
collect(distinct case when a2 is not null then n else null end) as col_appl_2nd_v4

unwind case when col_appl_2nd_v4 =[] then [null] else col_appl_2nd_v4 end as n
optional match (n:MOBILE)-[:APPLY_FOR]->(a2:LOAN_BK)-[:APPLY_ON]->(t2:TIME) where replace(t2.date,'-','')<='20220602'
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,col_appl_2nd_v4,
collect(distinct case when a2 is not null then n else null end) as col_bk_2nd_v4

unwind case when col_bk_2nd_v4 =[] then [null] else col_bk_2nd_v4 end as n
optional match (n:MOBILE)-[:APPLY_FOR]->(a2:LOAN_BK)-[:M2_ON]->(t2:TIME) where replace(t2.date,'-','')<='20220602'
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,col_appl_2nd_v4,col_bk_2nd_v4,
count(distinct case when a2 is not null then n else null end) as n_bad30p_2nd_v4

unwind case when col_appl_2nd_v4 =[] then [null] else col_appl_2nd_v4 end as n
optional match (n:MOBILE)-[:APPLY_FOR]->(a2:A_BLACK_LIST)-[:APPLY_ON]->(t2:TIME) where replace(t2.date,'-','')<='20220602'
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,col_appl_2nd_v4,
col_bk_2nd_v4,n_bad30p_2nd_v4,count(distinct case when a2 is not null then n else null end) as n_ablk_2nd_v4

unwind case when col_appl_2nd_v4 =[] then [null] else col_appl_2nd_v4 end as n
optional match (n:MOBILE)-[:APPLY_FOR]->(a2:C_BLACK_LIST)-[:APPLY_ON]->(t2:TIME) where replace(t2.date,'-','')<='20220602'
with m,col_appl_1st_v4,col_user_2nd_v4,col_mobile_2nd_v4,n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,col_appl_2nd_v4,
col_bk_2nd_v4,n_bad30p_2nd_v4,n_ablk_2nd_v4,count(distinct case when a2 is not null then n else null end) as n_cblk_2nd_v4

return size(col_appl_1st_v4) as n_appl_1st_v4,size(col_user_2nd_v4) as n_user_2nd_v4,
size(col_mobile_2nd_v4) as n_mobile_2nd_v4,size(col_appl_2nd_v4) as n_appl_2nd_v4,
n_cbkin_State_enterprise_leader_2nd_v4,n_cbkin_Engineer_2nd_v4,
size(col_bk_2nd_v4) as n_bk_2nd_v4,n_bad30p_2nd_v4,n_ablk_2nd_v4,n_cblk_2nd_v4,
size(filter(n in col_user_2nd_v4 where 'ORG' in labels(n))) as n_org_2nd_v4,
size(filter(n in col_user_2nd_v4 where 'EXPRESS' in labels(n))) as n_express_2nd_v4,
size(filter(n in col_user_2nd_v4 where 'AGENCY' in labels(n))) as n_agency_2nd_v4,
size(filter(n in col_user_2nd_v4 where 'BNK_ORG' in labels(n))) as n_bnk_org_2nd_v4,
size(filter(n in col_user_2nd_v4 where 'OTHER_ORG' in labels(n))) as n_other_org_2nd_v4

已经改了一点,后面的不会写,要走索引,怎么绕过索引呢

  match (m:`USER`) where id(m) in ["1510615318"]
optional match (m)-[r1:CALL_TO]-(x:MOBILE)-[:APPLY_FOR]->(:APPL)-[:APPLY_ON]-(t1:`TIME`)
where r1.first_callmark_on<=20220102 and t1.`TIME`.`date` < '2022-01-02'
optional match (x)-[r2:CALL_TO]-(n:`USER`)
where r2.first_callmark_on<=20220102 and id(n)<>'1510615318'
optional match (n)<-[r3:CBK_STATE_ENTERPRISE_LEADER]-(n2:`USER`)
where r3.first_cbkmark_on<=20220602 and id(n2)<>'1510615318'
optional match (n2)<-[r4:CBK_ENGINEER]-(n3:`USER`)
where r4.first_cbkmark_on<=20220602 and id(n3)<>'1510615318'
with
  m,
  collect(distinct x) as col_appl_1st_v4,
  collect(distinct n) as col_user_2nd_v4,
  count(distinct n2) as n_cbkin_State_enterprise_leader_2nd_v4,
  count(distinct case when n2 is not null then n3 else null end) as n_cbkin_Engineer_2nd_v4
with
  m,
  col_appl_1st_v4,
  col_user_2nd_v4,
  n_cbkin_State_enterprise_leader_2nd_v4,
  [uu in col_user_2nd_v4 WHERE "MOBILE" in labels(uu)] as col_mobile_2nd_v4,
  n_cbkin_Engineer_2nd_v4
return
  size(col_appl_1st_v4) as n_appl_1st_v4,
  size(col_user_2nd_v4) as n_user_2nd_v4,
  size(col_mobile_2nd_v4) as n_mobile_2nd_v4,
  n_cbkin_State_enterprise_leader_2nd_v4,
  n_cbkin_Engineer_2nd_v4

你可以在这个帖子下继续更新,因为问题的主题是没有变化的。以及,请提问的时候选对分类,如果选错分类、信息不全等不规范提问,是会影响审核的时间的,具体参考 关于论坛帖子审核和回复时间的说明(最后更新 2022.12.13)

因为这个帖子同之前的帖子类似,我将关联到之前的帖子,这个帖子先行关闭了。

1 个帖子被合并到现有话题中:nebula cypher 机器oom