Skip to content

Edge Creation with RID as input to Parameterized Query Not Working as Expected #1430

Description

@ironluca

Edge creation statement as parameterized query fails with exception when RID are provided as inputs for from and to rid

       RemoteDatabase db=new RemoteDatabase("localhost", 
                                                    2480, 
                                                    "test_db", 
                                                    "root", 
                                                    "password");

           //The below commented out section generates exception                                         
        /*
        * Exception in thread "main" com.arcadedb.remote.RemoteException: 
        * Error on executing remote operation CREATE EDGE ZEdg FROM :fromRid TO :toRid 
        * (cause:com.arcadedb.exception.CommandExecutionException detail:Invalid vertex for edge creation: #9:0)
        at com.arcadedb.remote.RemoteHttpComponent.manageException(RemoteHttpComponent.java:446)
        at com.arcadedb.remote.RemoteHttpComponent.httpCommand(RemoteHttpComponent.java:170)
        at com.arcadedb.remote.RemoteDatabase.databaseCommand(RemoteDatabase.java:461)
        at com.arcadedb.remote.RemoteDatabase.command(RemoteDatabase.java:398)
        at com.arcadedb.remote.RemoteDatabase.command(RemoteDatabase.java:383)
        at com.optimas.EdgeCreationtest.main(EdgeCreationtest.java:29)
        */
        /*String statement="CREATE EDGE ZEdg FROM :fromRid TO :toRid";

        String fromVtxRid="#9:0";
        String toVtxRid="#33:0";

        Map<String, Object> params=new HashMap<>();
        params.put("fromRid", new RID(null, fromVtxRid));
        params.put("toRid", new RID(null, toVtxRid));

        db.command("sql", statement, params);
        */
        //This section works and creates the edge
        String statement="CREATE EDGE ZEdg FROM #9:0 TO #33:0";
        db.command("sql", statement);

        System.out.println("Done ... ");

The exception is coming from CreateEdgesStep https://github.com/ArcadeData/arcadedb/blob/1a7716d309bbcbfdac089d42adee56b38fe2f6d3/engine/src/main/java/com/arcadedb/query/sql/executor/CreateEdgesStep.java#L252

The above has the routine to do RID specific processing (if statement) which is not engaging.
I am actually sending an RID object from client, it's getting converted to a Result object on the server side after JSON serialization/deserialization.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions