Skip to content

Commit

Permalink
Improve the error message when passing unexpected arguments to `g.pro…
Browse files Browse the repository at this point in the history
…ject()` (#2667)

## Related issue number

Fixes
#2619 (comment)
Fixes
#2626 (reply in thread)

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow committed Apr 28, 2023
1 parent 5646ce2 commit 8168275
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/graphscope/framework/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,19 @@ def project(
A new graph projected from the property graph, evaluated in eager mode.
"""
check_argument(self.graph_type == graph_def_pb2.ARROW_PROPERTY)
if isinstance(vertices, (list, set)) or isinstance(edges, (list, set)):
raise ValueError(
"\nThe project vertices or edges cannot be a set or a list, rather, a dict is expected, \n"
"where the key is the label name and the value is a list of property name. E.g.,\n"
"\n"
" g.project(vertices={'person': ['name', 'age']},\n"
" edges={'knows': ['weight']})\n"
"\n"
"The property list for vertices and edges can be empty if not needed, e.g.,\n"
"\n"
" g.project(vertices={'person': []}, edges={'knows': []})\n"
)

op = dag_utils.project_arrow_property_graph(
self, json.dumps(vertices), json.dumps(edges)
)
Expand Down

0 comments on commit 8168275

Please sign in to comment.