Skip to content

List comprehensions #105

Closed
Closed

Description

@ilyalasy

Hey,
are list comprehensions supported in AGE?
Using syntax from Neo4j doesnt seem to work, simple example:

SELECT * FROM cypher('g1', $$
MATCH (v)
RETURN [x in v.array_field]
$$) as (a agtype);

Activity

  1. Halkrine commented on Aug 17, 2021

    @Halkrine
    Contributor

    You mean that this query(array_field) is working or not with AGE?

    I tried that query. Once it works as 'query' (return as jsonb from Pgadmin).

    But I'm not sure this result is correct(Because it returns null).

    Someone who knows this issue?

  2. ilyalasy commented on Aug 17, 2021

    @ilyalasy
    Author

    You mean that this query(array_field) is working or not with AGE?

    I tried that query. Once it works as 'query' (return as jsonb from Pgadmin).

    But I'm not sure this result is correct(Because it returns null).

    Someone who knows this issue?

    array_field is some random array which is an attribute of a graph vertex.
    i'm trying it with AGE and receiving following error:

    ERROR:  variable `x` does not exist
    LINE 3: RETURN [x in v.array_field]
    
  3. Halkrine commented on Aug 17, 2021

    @Halkrine
    Contributor

    replace x -> v and try it.

  4. ilyalasy commented on Aug 17, 2021

    @ilyalasy
    Author

    replace x -> v and try it.

    no, it should be another variable: it should iterate through the array like in any list comprehension

  5. Halkrine commented on Aug 18, 2021

    @Halkrine
    Contributor

    Understood.

    Maybe, that function is not supported yet now..

  6. JoshInnis commented on Aug 18, 2021

    @JoshInnis
    Contributor

    Hi, List Comprehensions are not currently supported

  7. added
    enhancement
    help wanted
    question
    on Aug 18, 2021
  8. jasperblues commented on Sep 20, 2022

    @jasperblues
    Member

    Its a useful feature. Not sure if it will be the case on AGE but with Neo4j they can especially help with performance.

  9. jrgemignani commented on Sep 20, 2022

    @jrgemignani
    Contributor

    List comp. was "nearly" completed until it was found to have serious issues for any nested cases. It will be revisited soon.

  10. linked a pull request that will close this issueReimplement list comprehension #2169on Apr 27, 2025
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

    enhancementhelp wantedquestion

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions