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

Fix set_cover.greedy result type bug #76

Merged
merged 2 commits into from
Oct 14, 2021
Merged

Conversation

tonilastre
Copy link
Contributor

@tonilastre tonilastre commented Oct 11, 2021

When I try to use set_cover.greedy the following error is thrown:

Error: Query failed: set_cover.greedy: ValueError: Unable to insert field 'containing_set' with value: '<mgp.Vertex object at 0x7f83314cafd8>'; did you set the correct field type?

It is because the function tries to set Vertex into a result type List[Vertex] for key containing_set. Along with the fix, set_cover.greedy now has the same function call and response as set_cover.cp_solve.

When I try to use `set_cover.greedy` the following error is thrown:

> Error: Query failed: set_cover.greedy: ValueError: Unable to insert field 'containing_set' with value: '<mgp.Vertex object at 0x7f83314cafd8>'; did you set the correct field type?

It is because the function tries to set `Vertex` into a result type `List[Vertex]` for key `containing_set`. Along with the fix, `set_cover.greedy` has the same function call and response as `set_cover.cp_solve`.
@tonilastre tonilastre added type: bug Something isn't working status: ready PR is ready for review lang: python Issue on Python codebase labels Oct 11, 2021
@tonilastre tonilastre self-assigned this Oct 11, 2021
@jmatak
Copy link
Contributor

jmatak commented Oct 14, 2021

@Josipmrden Here is a reminder that this requires attention

Copy link
Collaborator

@Josipmrden Josipmrden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the fix, set_cover.greedy works as expected. Good for merging!

@Josipmrden
Copy link
Collaborator

The actual mistake that I made was in the last line

return [mgp.Record(containing_set=x) for x in resulting_nodes]

I assumed that this was a list. Since we're returning data in row-like fashion, it should actually be mgp.Vertex

@jmatak
Copy link
Contributor

jmatak commented Oct 14, 2021

Closes #76

@jmatak jmatak merged commit 69f0242 into main Oct 14, 2021
@jmatak jmatak deleted the fix-set-cover-greedy-result-type branch October 14, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: python Issue on Python codebase status: ready PR is ready for review type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants