Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cypher query in diff #2093

Merged
merged 1 commit into from
Apr 17, 2024
Merged

fix cypher query in diff #2093

merged 1 commit into from
Apr 17, 2024

Conversation

ibreakthecloud
Copy link
Contributor

diff query was returning the below exception:

Tue, 16 Apr 2024 13:20:34 +0000 DBG scan/scan_reporters.go:722 diff query:
        MATCH (m:VulnerabilityScan{node_id: $base_scan_id}) -[r:DETECTED]-> (d2)
        WITH collect(d2) as dset
        MATCH (n:VulnerabilityScan{node_id: $compare_to_scan_id}) -[r:DETECTED]-> (d)
        WHERE NOT d in dset
        OPTIONAL MATCH (d) -[:IS]-> (e)
        OPTIONAL MATCH (n) -[:SCANNED]-> (f)
        OPTIONAL MATCH (c:ContainerImage{node_id: f.docker_image_id}) -[:ALIAS] ->(t) -[ma:MASKED]-> (d)
        OPTIONAL MATCH (cb:ContainerImage{node_id: n.docker_image_id}) -[:IS] ->(is) -[mis:MASKED]-> (d)
        WITH apoc.map.merge( e{.*},
        d{.*, masked: coalesce(d.masked or r.masked or e.masked or head(collect(ma.masked)) or head(collect(mis.masked)), false),
        name: coalesce(e.name, d.name, '')}) AS d RETURN d  SKIP 0 LIMIT 99999
Tue, 16 Apr 2024 13:20:34 +0000 ERR handler/scan_reports.go:278 Neo4jError: Neo.ClientError.Statement.SyntaxError (Aggregation column contains implicit grouping expressions. For example, in 'RETURN n.a, n.a + n.b + count(*)' the aggregation expression 'n.a + n.b + count(*)' includes the implicit grouping key 'n.b'. It may be possible to rewrite the query by extracting these grouping/aggregation expressions into a preceding WITH clause. Illegal expression(s): e, e.masked, e.name, r.masked, d.masked, d.name, d (line 10, column 23 (offset: 490))
"       WITH apoc.map.merge( e{.*},"
                       ^)

@ibreakthecloud ibreakthecloud requested a review from noboruma April 17, 2024 06:09
Copy link
Collaborator

@noboruma noboruma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ibreakthecloud ibreakthecloud merged commit 716dca3 into main Apr 17, 2024
3 of 4 checks passed
@ibreakthecloud ibreakthecloud deleted the fix-diff branch April 17, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants