Skip to content

duplicated hints leads to duplicated result #81

Description

@khoale88

There seems a bug in hints, as hints is duplicated, result is duplicated as well

@pytest.mark.benchmark
    @pytest.mark.parametrize("graph_type", ACCEPTED_GRAPH_TYPES)
    def test_multiple_nodes_duplicated_hinted(self, graph_type):
        """
        Test the case where multiple nodes are hinted
        """
        host = graph_type()
        host.add_node(1, name="Home")
        host.add_node(2, name="Work")
        host.add_node(3, name="School")
        host.add_node(4, name="Library")
        host.add_node(5, name="Park")
        host.add_edge(1, 2)
        host.add_edge(1, 3)
        host.add_edge(2, 4)
        host.add_edge(3, 4)
        host.add_edge(4, 5)
        host.add_edge(5, 1)

        qry = """
        MATCH (A)-[r]->(B)
        RETURN A.name, B.name
        """

        gc = GrandCypher(host)
        res = gc.run(qry, hints=[{"A": 1, "B": 2}, {"A": 3, "B": 4}, {"A": 1, "B": 2}, {"A": 3, "B": 4}])   # <<<<<<<<< duplicated hints
        assert res == {"A.name": ["Home", "School"], "B.name": ["Work", "Library"]}

here is the result

>       assert res == {"A.name": ["Home", "School"], "B.name": ["Work", "Library"]}
E       AssertionError: assert {'A.name': ['Home', 'School', 'Home', 'School'], 'B.name': ['Work', 'Library', 'Work', 'Library']} == {'A.name': ['Home', 'School'], 'B.name': ['Work', 'Library']}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions