Skip to content

[Cypher] Batch and MERGE doesn't return all entries when they all exist, just the first one #2856

@ExtReMLapin

Description

@ExtReMLapin

Hello,
Version : Using latest release .

I discovered a bug that was there at least from version 25.8.1 to Latest release

The cypher we use :

UNWIND [54, 42, 12, 42, 65] as batchEntry
MERGE (n:TEST {integer: batchEntry})
return n, ID(n), true

(Translated to g.inject(' cypher.start').project(' GENERATED1', ' GENERATED2', ' GENERATED3', ' GENERATED4', ' GENERATED5').by(__.constant(54)).by(__.constant(42)).by(__.constant(12)).by(__.constant(42)).by(__.constant(65)).select(values).unfold().as('batchEntry').choose(__.V().as('n').hasLabel('TEST').where(__.select('n').values('integer').where(eq('batchEntry'))), __.V().as('n').hasLabel('TEST').where(__.select('n').values('integer').where(eq('batchEntry'))), __.identity().addV('TEST').as('n').property(single, 'integer', __.select('batchEntry'))).select('n').project('n', 'ID(n)', 'true').by(__.identity()).by(__.id()).by(__.constant(true)).project('n', 'ID(n)', 'true').by(__.select('n').valueMap().with('~tinkerpop.valueMap.tokens')).by(__.select('ID(n)').identity()).by(__.select('true').identity()) )

which returns on very first query :

ArcadeDB - The Next Generation Multi-Model DBMS

n	ID(n)	true
{"@rid":"#1:0","@type":"TEST","integer":54}	#1:0	true
{"@rid":"#1:1","@type":"TEST","integer":42}	#1:1	true
{"@rid":"#1:2","@type":"TEST","integer":12}	#1:2	true
{"@rid":"#1:3","@type":"TEST","integer":42}	#1:3	true
{"@rid":"#1:4","@type":"TEST","integer":65}	#1:4	true

When you re-run the exact same query it returns only

ArcadeDB - The Next Generation Multi-Model DBMS

n	ID(n)	true
{"@rid":"#1:0","@type":"TEST","integer":54}	#1:0	true

When you add another entry at the END

ArcadeDB - The Next Generation Multi-Model DBMS

n	ID(n)	true
{"@rid":"#1:0","@type":"TEST","integer":54}	#1:0	true
{"@rid":"#1:5","@type":"TEST","integer":66666666}	#1:5	true

And at the START :

ArcadeDB - The Next Generation Multi-Model DBMS

n	ID(n)	true
{"@rid":"#1:6","@type":"TEST","integer":111111111111}	#1:6	true
{"@rid":"#1:7","@type":"TEST","integer":54}	#1:7	true
{"@rid":"#1:8","@type":"TEST","integer":42}	#1:8	true
{"@rid":"#1:9","@type":"TEST","integer":12}	#1:9	true
{"@rid":"#1:10","@type":"TEST","integer":42}	#1:10	true
{"@rid":"#1:11","@type":"TEST","integer":65}	#1:11	true
{"@rid":"#1:12","@type":"TEST","integer":66666666}	#1:12	true


From my understanding, the bugs can be translated to :

  • when there is no node created (all merged), it only returns the first entry
  • when there is all node created it returns them all
  • when there is one node created it returns it AND then next ones

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions