Skip to content

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

@Jatapiaro

Description

@Jatapiaro

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.

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