Skip to content

Commit 33b7e97

Browse files
authored
fix compile app with string oid graph, add a simple test (#120)
1 parent 3bc97d9 commit 33b7e97

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

python/graphscope/framework/dag_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def create_app(graph, app):
4141
config = {
4242
types_pb2.APP_ALGO: utils.s_to_attr(app.algo),
4343
types_pb2.GRAPH_TYPE: utils.graph_type_to_attr(graph.graph_type),
44-
types_pb2.OID_TYPE: utils.s_to_attr(graph.schema.oid_type),
44+
types_pb2.OID_TYPE: utils.s_to_attr(
45+
utils.normalize_data_type_str(graph.schema.oid_type)
46+
),
4547
types_pb2.VID_TYPE: utils.s_to_attr(graph.schema.vid_type),
4648
types_pb2.V_DATA_TYPE: utils.s_to_attr(
4749
utils.data_type_to_cpp(graph.schema.vdata_type)

python/tests/conftest.py

+28
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,28 @@ def p2p_property_graph(graphscope_session):
466466
yield g
467467

468468

469+
@pytest.fixture(scope="module")
470+
def p2p_property_graph_string(graphscope_session):
471+
g = graphscope_session.load_from(
472+
edges={
473+
"knows": (
474+
Loader("{}/p2p-31_property_e_0".format(property_dir), header_row=True),
475+
["src_label_id", "dst_label_id", "dist"],
476+
("src_id", "person"),
477+
("dst_id", "person"),
478+
),
479+
},
480+
vertices={
481+
"person": Loader(
482+
"{}/p2p-31_property_v_0".format(property_dir), header_row=True
483+
),
484+
},
485+
generate_eid=False,
486+
oid_type="string",
487+
)
488+
yield g
489+
490+
469491
@pytest.fixture(scope="module")
470492
def p2p_property_graph_undirected(graphscope_session):
471493
g = graphscope_session.load_from(
@@ -501,6 +523,12 @@ def p2p_project_undirected_graph(p2p_property_graph_undirected):
501523
yield pg
502524

503525

526+
@pytest.fixture(scope="module")
527+
def p2p_project_directed_graph_string(p2p_property_graph_string):
528+
pg = p2p_property_graph_string.project_to_simple(0, 0, 0, 2)
529+
yield pg
530+
531+
504532
@pytest.fixture(scope="module")
505533
def projected_pg_no_edge_data(arrow_property_graph):
506534
pg = arrow_property_graph.project_to_simple(0, 0, None, None)

python/tests/test_app.py

+6
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ def test_app_on_undirected_graph(
341341
assert np.all(ctx10.to_numpy("r", vertex_range={"begin": 1, "end": 4}) == [0, 0, 0])
342342

343343

344+
def test_run_app_on_string_oid_graph(p2p_project_directed_graph_string):
345+
ctx = sssp(p2p_project_directed_graph_string, src="6")
346+
r1 = ctx.to_dataframe({"node": "v.id", "r": "r"})
347+
assert r1[r1["node"] == "6"].r.values[0] == 0.0
348+
349+
344350
def test_error_on_parameters_not_correct(arrow_project_graph):
345351
# Incorrect type of parameters
346352
with pytest.raises(ValueError, match="could not convert string to float"):

0 commit comments

Comments
 (0)