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.export.csv.query() does not register duration.inSeconds formatting #121

Closed
neo-technology-build-agent opened this issue Sep 1, 2022 · 6 comments

Comments

@neo-technology-build-agent
Copy link
Collaborator

Issue by edtky
Sunday Apr 28, 2019 at 19:58 GMT
Originally opened as neo4j-contrib/neo4j-apoc-procedures#1184


Guidelines

Please note that GitHub issues are only meant for bug reports/feature requests. If you have questions on how to use APOC, please ask on the Neo4j Discussion Forum instead of creating an issue here.

Expected Behavior (Mandatory)

CALL apoc.export.csv.query(" ... ... RETURN duration.inSeconds(a.timeStamp, b.timeStamp) ..." )
should return "P0M0DT2651S" in the csv file (only seconds)

Actual Behavior (Mandatory)

wrongly returns "PT44M11S" in csv file (minutes and seconds)
(when queried directly on Neo4j, it correctly returns "P0M0DT930S" on the dashboard)

How to Reproduce the Problem

Simple Dataset (where it's possible)

//Insert here a set of Cypher statements that helps us to reproduce the problem

Steps (Mandatory)

Screenshots (where it's possible)

Screen Shot 2019-04-28 at 11 31 00 AM

Specifications (Mandatory)

Currently used versions

Versions

  • OS:
  • Neo4j:
  • Neo4j-Apoc:
@neo-technology-build-agent
Copy link
Collaborator Author

Comment by vboulaye
Saturday Oct 05, 2019 at 11:27 GMT


Hi,
I tried to work on this issue.
I managed to reproduce it (I made a test in dba589c95267db960d86c7ae41ad260a9359a96b).

But I cannot figure out how the dashboard is working: the output from csv.query is calling the toString() from DurationValuè which is always computing an hour/minute component from the seconds in the duration.

@neo-technology-build-agent
Copy link
Collaborator Author

Comment by enriquezrene
Wednesday Oct 23, 2019 at 18:15 GMT


@vboulaye
The issue is DurationValue.toString is invoking prettyPrint() which transforms seconds to hours, minutes.

@neo-technology-build-agent
Copy link
Collaborator Author

Comment by enriquezrene
Wednesday Oct 23, 2019 at 18:34 GMT


I think the following PR might work neo4j-contrib/neo4j-apoc-procedures#1322
I took the changes from your commit. @vboulaye

@neo-technology-build-agent
Copy link
Collaborator Author

Comment by fbiville
Friday Mar 05, 2021 at 17:43 GMT


I managed to reproduce it (I made a test in dba589c).

Based on a slightly updated variant of this test, the Java API of Neo4j and Cypher-Shell return 1 value: "PT9H5M35.353S".
Neo4j Browser returns another P0M0DT32735.353000000S.
It might be a driver issue.

@neo-technology-build-agent
Copy link
Collaborator Author

Comment by conker84
Thursday May 13, 2021 at 12:38 GMT


@fbiville any news on this?

@gem-neo4j
Copy link
Contributor

Hi there!

I see the confusion, as mentioned above, it is the pretty print of the duration that looks like it isn't in seconds. The actual Duration object however is still in seconds and is equivalent. What I suggest is that if you want to export seconds specifically to not use the default toString on a duration:

e.g specifically pull out the seconds:
RETURN duration.inSeconds(datetime('2015-06-24T12:05:35.556+0100'), datetime('2015-06-24T12:50:30.556+0100')).seconds

As this is not an APOC issues (will happen if you simply run in Browser:
RETURN toString(duration.inSeconds(datetime('2015-06-24T12:05:35.556+0100'), datetime('2015-06-24T12:50:30.556+0100')))

I will close this, feel free to open an issue on Neo4j about the pretty print :)

Thanks,
Gem

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