How to circumvent the AggregationSkippedNull warning with cypher query

Hi I was wondering if I could suppress this warning, by either log suppression or by changing the query:

{code: Neo.ClientNotification.Statement.AggregationSkippedNull} {category: UNRECOGNIZED} {title: The query contains an aggregation function that skips null values.} {description: null value eliminated in set function.} {position: None} 

The query I run is this one, to capture changes from the change log:

            WITH current_id
            OPTIONAL CALL db.cdc.query($change_cursor_id,$selectors) YIELD id as log_id, metadata, event
            WITH current_id, count(log_id) as result_size,  collect({log_id:log_id, metadata: metadata, event:event}) as change_entries
            RETURN current_id, CASE result_size WHEN 0 THEN [] ELSE change_entries END as change_entries, result_size

It results in:

╒══════════════════════════════════════════════════════════╤══════════════╤═══════════╕
│current_id                                                │change_entries│result_size│
╞══════════════════════════════════════════════════════════╪══════════════╪═══════════╡
│"CUAL0JzdYEVUrmuTUcXh5sMAAAAAAAhyY3__________AAABlc3pfKQ="│[]            │0          │
└──────────────────────────────────────────────────────────┴──────────────┴───────────┘

or if it finds changes:

Table
Text
Code
╒══════════════════════════════════════════════════════════╤══════════════════════════════════════════════════════════════════════╤═══════════╕
│current_id                                                │change_entries                                                        │result_size│
╞══════════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════╪═══════════╡
│"CUAL0JzdYEVUrmuTUcXh5sMAAAAAAAhzwH__________AAABlc32tl4="│[{log_id: "CUAL0JzdYEVUrmuTUcXh5sMAAAAAAAhzwAAAAAAAAAAAAAABlc32tl4=", │1          │
│                                                          │metadata: {txMetadata: {}, executingUser: "neo4j", databaseName: "csp"│           │
│                                                          │, connectionClient: "10.28.92.237:41828", authenticatedUser: "neo4j", │           │
│                                                          │captureMode: "DIFF", connectionServer: "10.28.98.90:7688", connectionT│           │
│                                                          │ype: "bolt", serverId: "801b141c", txStartTime: "2025-03-25T15:40:52.6│           │
│                                                          │87000000Z", txCommitTime: "2025-03-25T15:40:52.702000000Z"}, event: {e│           │
│                                                          │lementId: "4:400bd09c-dd60-4554-ae6b-9351c5e1e6c3:21712449", keys: {},│           │
│                                                          │ state: {before: {properties: {cursor: "CUAL0JzdYEVUrmuTUcXh5sMAAAAAAA│           │
│                                                          │hzvn__________AAABlc32fuw="}, labels: []}, after: {properties: {cursor│           │
│                                                          │: "CUAL0JzdYEVUrmuTUcXh5sMAAAAAAAhzv3__________AAABlc32hzI="}, labels:│           │
│                                                          │ []}}, eventType: "n", operation: "u", labels: ["CspCdcChangeCursor"]}│           │
│                                                          │}]                                                                    │           │
└──────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┴───────────┘

I'm satisfied with the results, but I want to get rid of the warning.

In another recommendation I read not to use OPTIONAL CALL but use CALL but If I do that the query stops with zero rows. Anyone has an idea how to solve it without the warning that fills our logs?

The database version we have is:

╒══════════════╤════════╤════════════╕
│name          │version │edition     │
╞══════════════╪════════╪════════════╡
│"Neo4j Kernel"│"5.26.2"│"enterprise"│
└──────────────┴────────┴────────────┘

I'm using the python bolt driver to query the database.

Both the count and collect functions will ignore null values. I guess you are getting the warning because the optional call could return a null value, so you get the warning. You could try a refactored version that would avoids this.

Try this:

WITH current_id, COLLECT {
    CALL db.cdc.query($change_cursor_id,$selectors) YIELD id, metadata, event
    RETURN {log_id: id, metadata: metadata, event:event}
} as change_entries
RETURN current_id, size(change_entries) as result_size,  change_entries

The difference here is the the COLLECT subquery will return an empty list is no records are found.

Btw- I don’t understand the relationship with your current_id value and the rest of the query. It is not correlated with anything.

Hi, @daniel.portier,

That warning was introduced because the GQL standard requires it, but it can be annoying. We have decided to withdraw the warning.
Starting from the next patch release of the LTS version (I guess 5.26.5) or the April periodic release (2025.04.0), it will not be generated anymore. So, upgrading will be a way of getting rid of the warning.