(ldbc_graph, arrow_modern_graph)
| 634 | |
| 635 | |
| 636 | def test_add_column(ldbc_graph, arrow_modern_graph): |
| 637 | ldbc = ldbc_graph |
| 638 | modern = arrow_modern_graph |
| 639 | |
| 640 | sub_graph_1 = ldbc.project(vertices={"person": []}, edges={"knows": ["eid"]}) |
| 641 | sub_graph_2 = ldbc.project( |
| 642 | vertices={"person": None, "tag": None}, edges={"hasInterest": None} |
| 643 | ) |
| 644 | sub_graph_3 = ldbc.project( |
| 645 | vertices={"tag": None, "tagclass": None}, edges={"hasType": None} |
| 646 | ) |
| 647 | sub_graph_4 = modern.project(vertices={"person": []}, edges={"knows": ["eid"]}) |
| 648 | |
| 649 | ret = graphscope.pagerank(sub_graph_1) |
| 650 | |
| 651 | # the ret can add to the graph queried on |
| 652 | g1 = sub_graph_1.add_column(ret, selector={"pr": "r"}) |
| 653 | assert g1.schema.get_vertex_properties("person")[0].id == 8 |
| 654 | assert g1.schema.get_vertex_properties("person")[0].name == "pr" |
| 655 | # the ret can add to the origin graph |
| 656 | g2 = ldbc.add_column(ret, selector={"pr": "r"}) |
| 657 | assert g2.schema.get_vertex_properties("person")[8].id == 8 |
| 658 | assert g2.schema.get_vertex_properties("person")[8].name == "pr" |
| 659 | # the ret can add to the graph tha contain the same vertex label with sub_graph_1 |
| 660 | g3 = sub_graph_2.add_column(ret, selector={"pr": "r"}) |
| 661 | assert g3.schema.get_vertex_properties("person")[8].id == 8 |
| 662 | assert g3.schema.get_vertex_properties("person")[8].name == "pr" |
| 663 | # the ret cannot add to sub_graph_3 |
| 664 | with pytest.raises(AnalyticalEngineInternalError): |
| 665 | g4 = sub_graph_3.add_column(ret, selector={"pr": "r"}) |
| 666 | print(g4.schema) |
| 667 | # the ret cannot add to sub_graph_4 |
| 668 | with pytest.raises(AnalyticalEngineInternalError): |
| 669 | g5 = sub_graph_4.add_column(ret, selector={"pr": "r"}) |
| 670 | print(g4.schema) |
| 671 | |
| 672 | |
| 673 | def test_add_column_string_oid( |
nothing calls this directly
no test coverage detected