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

Trying to use abs in getVertices gives ('parsing filter failed', '609') exception #217

Open
Jatapiaro opened this issue Apr 15, 2024 · 0 comments

Comments

@Jatapiaro
Copy link

Bug Description
I want to query one of my vertexes, but the fields on it are floats. Thus, TigerGraph suggests to do abs(x - value) < epsilon.
However, trying to do this throws the following exception.

('parsing filter failed', '609')

To Reproduce
Steps to reproduce the behavior:

  1. Create a new edge which all its parameters are float values.
  2. Create a function like this in python:
    def __get_vertex_id_if_exists(
        self, vertex_type: str, where: str
    ) -> Optional[str]:
        try:
            result = self.__connection.getVertices(
                vertexType=vertex_type, where=where, limit=1
            )
            if len(result) == 0:
                return None

            result_dict = result[0]
            if not isinstance(result_dict, dict):
                return None

            return result_dict[VERTEX_ID_KEY]
        except TigerGraphException as e:
            raise e
        except Exception as e:
            print("type is:", e.__class__.__name__)
            raise e

Then try to call it using:

        x_value = 1.0
        where_query = (
            f"abs(x - x_value) < 0.0001"
        )
        existing_rect_id = self.__get_vertex_id_if_exists(
            vertex_type="your_vertex", where=where_query
        )

Expected behavior
I expect to get an item that matches my query.

Additional context
The documentation doesn't show clear examples on how to use the where syntax. So far I tried this in other places:

        where_query = (
            f'platform == "{metadata.platform}"'
            " AND "
            f'device_model == "{metadata.device_model}"'
        )

Which doesn't gives an error, but I've been unable to verify if that actually works. Definitely more details about how to use it will be good. Docs just say to use a comma separated string.

@Jatapiaro Jatapiaro changed the title Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Apr 15, 2024
@Jatapiaro Jatapiaro changed the title Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Apr 15, 2024
@Jatapiaro Jatapiaro changed the title Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Trying to use abs in getVertices gives ('parsing filter failed', '609') exception Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant