Skip to content
This repository has been archived by the owner on Apr 4, 2021. It is now read-only.

Resolution error for graph elements as lists items #332

Open
szarnyasg opened this issue Mar 4, 2018 · 0 comments
Open

Resolution error for graph elements as lists items #332

szarnyasg opened this issue Mar 4, 2018 · 0 comments
Assignees

Comments

@szarnyasg
Copy link
Member

The following query does not compile because the compiler does not expect that a list item can be a graph element (in this case, a vertex).

MATCH (p:Person)
WITH collect(p) AS ps
WITH ps[0] AS p
RETURN p.id

Stacktrace:

Unexpected type found: class ingraph.model.expr.ExpressionAttribute at basis position of property dereferencing. String value of the object is: expressionattribute(indexlookupexpression(expressionattribute('collect(vertexattribute(p, vertexlabelset(Empty), false, Some(p#0))), ps, Some(ps#0)), 0), p, Some(p#1))
ingraph.compiler.exceptions.UnexpectedTypeException: Unexpected type found: class ingraph.model.expr.ExpressionAttribute at basis position of property dereferencing. String value of the object is: expressionattribute(indexlookupexpression(expressionattribute('collect(vertexattribute(p, vertexlabelset(Empty), false, Some(p#0))), ps, Some(ps#0)), 0), p, Some(p#1))
	at ingraph.compiler.cypher2qplan.QPlanResolver$$anonfun$expressionNameResolver$1.applyOrElse(QPlanResolver.scala:246)
	at ingraph.compiler.cypher2qplan.QPlanResolver$$anonfun$expressionNameResolver$1.applyOrElse(QPlanResolver.scala:194)
	at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$2.apply(TreeNode.scala:267)
	at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$2.apply(TreeNode.scala:267)
	at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:70)
	at org.apache.spark.sql.catalyst.trees.TreeNode.transformDown(TreeNode.scala:266)
	at org.apache.spark.sql.catalyst.trees.TreeNode.transform(TreeNode.scala:256)
	at ingraph.compiler.cypher2qplan.QPlanResolver$.ingraph$compiler$cypher2qplan$QPlanResolver$$r2$1(QPlanResolver.scala:105)
	at ingraph.compiler.cypher2qplan.QPlanResolver$.ingraph$compiler$cypher2qplan$QPlanResolver$$r$1(QPlanResolver.scala:103)
	at ingraph.compiler.cypher2qplan.QPlanResolver$$anonfun$4.apply(QPlanResolver.scala:137)
	at ingraph.compiler.cypher2qplan.QPlanResolver$$anonfun$4.apply(QPlanResolver.scala:136)

This is not a serious issue, as it can be trivially worked around by collecting the ids in the first place:

MATCH (p:Person)
WITH collect(p.id) AS ps
WITH ps[0] AS p
RETURN p

So we should only work on this if it's not a significant effort.

@szarnyasg szarnyasg added this to the wishes and dreams milestone Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants