neo4j / apoc

Apache License 2.0
81 stars 27 forks source link

Cypher script generated by apoc.export.cypher.all leaves the temporary `UNIQUE IMPORT ID REL` relationship properties #631

Closed HEnquist closed 2 months ago

HEnquist commented 3 months ago

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)

When executing the cypher script, I expect the temporary UNIQUE IMPORT ID REL relationship properties to be removed, as is done for the similar UNIQUE IMPORT ID node properties.

Actual Behavior (Mandatory)

All created relationships have an unwanted UNIQUE IMPORT ID REL property.

How to Reproduce the Problem

Simple Dataset (where it's possibile)

This tiny dataset is sufficient:

CREATE (n:DummyNode)-[r:DUMMYREL]->(m:OtherDummy)

Steps (Mandatory)

  1. Select a database with some data (the exact data is unimportant).

  2. Export as cypher, with the multipleRelationshipsWithType option set to true:

    CALL apoc.export.cypher.all(null, {format: 'cypher-shell', multipleRelationshipsWithType: true})
  3. Check the resulting cypher statements. Example:

    :begin
    CREATE CONSTRAINT UNIQUE_IMPORT_NAME FOR (node:`UNIQUE IMPORT LABEL`) REQUIRE (node.`UNIQUE IMPORT ID`) IS UNIQUE;
    :commit
    CALL db.awaitIndexes(300);
    :begin
    UNWIND [{_id:1, properties:{}}] AS row
    CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:OtherDummy;
    UNWIND [{_id:0, properties:{}}] AS row
    CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:DummyNode;
    :commit
    :begin
    UNWIND [{start: {_id:0}, id: 0, end: {_id:1}, properties:{}}] AS row
    MATCH (start:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.start._id})
    MATCH (end:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.end._id})
    CREATE (start)-[r:DUMMYREL{`UNIQUE IMPORT ID REL`:row.id}]->(end) SET r += row.properties;
    :commit
    :begin
    MATCH (n:`UNIQUE IMPORT LABEL`)  WITH n LIMIT 20000 REMOVE n:`UNIQUE IMPORT LABEL` REMOVE n.`UNIQUE IMPORT ID`;
    :commit
    :begin
    DROP CONSTRAINT UNIQUE_IMPORT_NAME;
    :commit
  4. Note that the UNIQUE IMPORT ID node properties are removed at the end, but not the UNIQUE IMPORT ID REL relationship properties.

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions

Versions

Lojjs commented 3 months ago

Thanks for reporting, this is a bug. As you expected all the temporary properties are supposed to be cleaned up. We will let you know when it has been fixed.

Best regards Louise, Neo4j