Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 利用Cypher查询节点,不返回节点属性,节点属性必须指定,并且返回的结果不稳定? #3768

Open
yimijiu123 opened this issue May 6, 2024 · 2 comments
Assignees

Comments

@yimijiu123
Copy link

yimijiu123 commented May 6, 2024

Describe the bug
运行代码
`sess = get_default_session()
#string点
graph = sess.g(oid_type="string")
idd = np.array(['a', 'b', 'c', 'd'])
avg_score = np.array([490.33, 164.5, 190.25, 762.0])
v_data = np.transpose(np.vstack([idd, avg_score]))
df_student = pd.DataFrame(v_data, columns=["idd", "avg_score"])
src_id = np.array(['a', 'b', 'c', 'd'])
dst_id = np.array(['b', 'd', 'b', 'd'])
group_size = np.array([4, 1,2, 3])
e_data = np.transpose(np.vstack([src_id, dst_id, group_size]))
df_group = pd.DataFrame(e_data, columns=["src_id", "dst_id", "group_size"]).astype({"group_size": int})
graph = graph.add_vertices(df_student,label="student",properties=["avg_score"])
graph=graph.add_edges(df_group,label="guide",src_label="student",dst_label="student")

interactive = graphscope.interactive(graph,with_cypher=True)
e = interactive.execute("MATCH (n) RETURN n limit 3;",lang="cypher")
for record in e.records:
print(record)

e = interactive.execute("MATCH (n) RETURN n.idd limit 3;",lang="cypher")
for record in e.records:
print(record)

e = interactive.execute("MATCH (n) RETURN n.avg_score limit 3;",lang="cypher")
for record in e.records:
print(record)

e = interactive.execute("MATCH (n) RETURN n.idd,n.avg_score,n limit 3;",lang="cypher")
for record in e.records:
print(record)

e = interactive.execute("MATCH (n) RETURN n,n.idd,n.avg_score limit 3;",lang="cypher")
for record in e.records:
print(record)`
运行结果:
企业微信截图_17149821074077

问题

  1. 可以看出"MATCH (n) RETURN n limit 3;"只返回节点内置标签,graph中定义的id值a、b、c、d不显示,节点属性也不返回。
  2. 要返回节点的属性必须要指定,但是如果第一次指定了属性,后续再换一个属性指定还是会返回第一次指定的,比如第一次指定n.avg_score,第二次如果指定n.idd,返回的会是n.avg_score的值。
  3. 返回n.idd,n.avg_score,n和n,n.idd,n.avg_score,如果更改return的顺序,返回的赋值是混乱的。
  4. 如果执行"MATCH (n) RETURN n.properties limit 3;",会提示_neo4j.exceptions.DatabaseError: {code: Neo.DatabaseError.General.UnknownError} {message: java.lang.IllegalArgumentException: {property=properties} not found; expected properties are: [avg_score, idd]}_,说明 [avg_score, idd]是作为属性的,但是不在n(节点)本身在properties字典中,这很奇怪。
  5. 如果要返回满足条件的节点的全部属性应该怎么做?
    企业微信截图_17149826565551
    并不能成功。
@yimijiu123 yimijiu123 changed the title [BUG] 利用Cypher查询节点,不返回节点属性,节点属性必须指定,并且返回的结果不稳定 [BUG] 利用Cypher查询节点,不返回节点属性,节点属性必须指定,并且返回的结果不稳定? May 7, 2024
@longbinlai longbinlai assigned longbinlai and shirly121 and unassigned longbinlai May 8, 2024
@shirly121
Copy link
Collaborator

shirly121 commented May 8, 2024

感谢你对我们的宝贵意见,我这里回复下你提出的几点问题:

  • 返回点/边里没有属性
    这个是因为我们默认采取了lazy mode来返回点/边数据,如果没有特别指定,返回的点边就会缺省properties,主要从减少数据量角度考虑;

  • 第二次返回和第一次返回重复
    这个表现不太正常,我猜测有没有可能是client端对结果有cache导致的呢?我这边也尽快找环境看看能不能复现;

  • 返回column乱序
    这个问题已经fix在 3672,graphscope最新版本是0.27.0,还没包含该fix,在下一个版本里会带上;

  • 如何获取点的所有属性
    n.properties意思是获取n点中名为'properties'的属性,但点并没有'properties'属性所以会产生上述报错;如果要获取所有属性,官方用法是properties(n),这个我们目前还未支持,我这边新建了issue 3773 会尽快补充该功能;

@yimijiu123
Copy link
Author

非常感谢您的回复,等待issue 3773的更新。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants