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

apoc.nodes.group seems unable to use DateTime as a grouping operator #116

Open
neo-technology-build-agent opened this issue Sep 1, 2022 · 1 comment

Comments

@neo-technology-build-agent
Copy link
Collaborator

Issue by jgaskins
Saturday Mar 23, 2019 at 07:40 GMT
Originally opened as neo4j-contrib/neo4j-apoc-procedures#1129


Expected Behavior (Mandatory)

Specifying min or max as a grouping operator on a datetime property groups

Actual Behavior (Mandatory)

Specifying min or max as a grouping operator on a datetime property results in an empty set.

I imagine this applies to other temporal types, as well, but I just happened to be using datetime when I discovered it.

How to Reproduce the Problem

Simple Dataset (where it's possibile)

First we create some nodes with datetime timestamps:

UNWIND range(1, 1000) AS minutes
CREATE (:Foo {
    created_at: datetime({ year: 2019, month: 3, day: 23 }) - duration({minutes: minutes})
})

Then we truncate those timestamps to some level of granularity we'll be grouping on:

MATCH (foo:Foo)
WHERE NOT exists(foo.created_at_hour)
SET foo.created_at_hour = datetime.truncate('hour', foo.created_at)

Steps (Mandatory)

  1. Build the data set with the 2 Cypher queries above
  2. Execute [Query 1] below with no grouping operators, data is returned
  3. Execute [Query 2] below with a grouping operator specified for one of the datetime properties, no data is returned

[Query 1]

CALL apoc.nodes.group(['Foo'], ['created_at_hour'], [{}]) YIELD node
RETURN node

[Query 2]

CALL apoc.nodes.group(['Foo'], ['created_at_hour'], [{ created_at: 'min' }]) YIELD node
RETURN node

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions

Versions

  • OS: Ubuntu 18.04
  • Neo4j: 3.5.3 Community
  • Neo4j-Apoc: 3.5.0.2
@neo-technology-build-agent
Copy link
Collaborator Author

Comment by jexp
Saturday Mar 23, 2019 at 07:45 GMT


Good find, I guess it was because it was implemented before those datatypes were added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants