'UPSERT' in 'SQL - CREATE EDGE' does not work as expected

OS: Linux 2.6.32-696.16.1.el6.x86_64 x86_64
OrientDB Version: orientdb-3.0.21
OrientDB deployment: one master + one replica

Steps to reproduce

  1. Creating database, and creating a UNIQUE index on in out of edge.

  2. Adding new vertices

  3. Creating edges using below SQL command:
    sql = “CREATE EDGE $edgeName UPSERT FROM $from TO $to”
    graph.command(new OCommandSQL(sql)).execute()

  4. Creating same edges (for testing) using the same SQL command:
    sql = “CREATE EDGE $edgeName UPSERT FROM $from TO $to”
    graph.command(new OCommandSQL(sql)).execute()

Expected behavior

In step 4, there should be no ‘ORecordDuplicatedException’, since OrientDB should skip the creation of edges that already exist between two vertices automaticlly and silently.

Actual behavior

It throws ‘ORecordDuplicatedException’ everytime it executes “CREATE EDGE $edgeName UPSERT FROM $from TO $to”.

Here is the information of the UNIQUE INDEX of in out of edge.
|InputEventId.out_in |UNIQUE | 371546|InputEventId | |