apache / age

Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.
https://age.apache.org
Apache License 2.0
3.05k stars 408 forks source link

List comprehensions #105

Open ilyalasy opened 3 years ago

ilyalasy commented 3 years ago

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);
Halkrine commented 3 years ago

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?

ilyalasy commented 3 years ago

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]
Halkrine commented 3 years ago

replace x -> v and try it.

ilyalasy commented 3 years ago

replace x -> v and try it.

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

Halkrine commented 3 years ago

Understood.

Maybe, that function is not supported yet now..

JoshInnis commented 3 years ago

Hi, List Comprehensions are not currently supported

jasperblues commented 2 years ago

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

jrgemignani commented 2 years ago

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