apache / apache/grails-core

Complex query seems doesn`t build properly

Open
#14,635 2 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

The query
https://gyazo.com/2ca3f7c263107a864728188138391476
Its builded to:
`QUERY Cypher [MATCH (n:AclEntry), (n)-[:ACLOBJECTIDENTITY]->(m_1), (n)-[:SID]->(m_0) WHERE ( ( m_0.sid=~{1} ) AND ( m_1.objectId={2} ) AND )
OPTIONAL MATCH(n)-[:SID]->(sidNode)
OPTIONAL MATCH(n)-[:ACLOBJECTIDENTITY]->(aclObjectIdentityNode) RETURN n as data
, collect(DISTINCT aclObjectIdentityNode) as aclObjectIdentityNodes, collect(DISTINCT sidNode) as sidNodes ] for params [[1:^\QadminUser5\E$, 2:rootClass5]]`
and this too:
https://gyazo.com/18e3ab1341fa785e9b19e6b1c02f0a11
`QUERY Cypher [MATCH (n:AclEntry), (n)-[:ACLOBJECTIDENTITY]->(m_0), (n)-[:SID]->(m_1), (m_1)-[:SID]->(m_2) WHERE ( ( AND ( m_2.__id__={1} ) ) )
OPTIONAL MATCH(n)-[:SID]->(sidNode)
OPTIONAL MATCH(n)-[:ACLOBJECTIDENTITY]->(aclObjectIdentityNode) RETURN n as data
, collect(DISTINCT aclObjectIdentityNode) as aclObjectIdentityNodes, collect(DISTINCT sidNode) as sidNodes ] for params [[1:%admin%]]`

Contributor guide

Open the contributing guide

Research direction

The report contains two malformed generated Cypher queries, including empty conditions in their WHERE clauses. Start by reproducing the reported query-building behavior from the issue examples and trace the entry point that assembles these clauses. Done means the same query scenarios produce valid Cypher without empty predicates, with regression coverage added if the relevant test location can be found.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.