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

Update edge with Upsert #8424

Closed
gtadudeps opened this issue Jul 22, 2018 · 9 comments
Closed

Update edge with Upsert #8424

gtadudeps opened this issue Jul 22, 2018 · 9 comments
Assignees
Labels

Comments

@gtadudeps
Copy link

gtadudeps commented Jul 22, 2018

OrientDB Version: v3.0.3

Java Version: 8

OS: macOS

Expected behavior

Update edge with upsert should cover case like:
NodeObj vertex has unique index on qName.
ImpactEdge vertex has unique index on edgeId.

Running commands

CREATE VERTEX NodeObj CONTENT {"tD":1,"qName":"1.101.4.2881","cT":1531588634559} ;
CREATE VERTEX NodeObj CONTENT {"tD":1,"qName":"1.101.4.3620","cT":1531588634559} ;
UPDATE Edge ImpactEdge SET out = ( SELECT FROM NodeObj where qName='1.101.4.2881') , in = ( SELECT FROM NodeObj where qName='1.101.4.3620') , edgeId= '1.101.4.2881_1.101.4.3620_9223372036854775807' UPSERT WHERE edgeId = '1.101.4.2881_1.101.4.3620_9223372036854775807' . 

should create a edge between two vertices if doesn't exists and update IN and OUT fields on the vertices as well.

Actual behavior

It creates the edge and sets the @rid properly within the edge but its not updating the IN and OUT fields on the vertices and thus breaks the graph.

Steps to reproduce

Running the above commands should re-create the scenario.

@gtadudeps
Copy link
Author

Please look into this issue as well it has become a major bottleneck for us. #8427 thanks!

@TariqAHassan
Copy link

+1

I have also encountered this bug.

It is a major bottleneck for us too and it has forced us to fallback to far less performant solutions.

@luigidellaquila
Copy link
Member

Hi @TariqAHassan @gtadudeps

UPSERT is available in v 3.0 but only to create/update an edge between two vertices (ie. avoid to re-create an edge between the same two vertices), and not to change the out, in properties.

Thanks

Luigi

@TariqAHassan
Copy link

TariqAHassan commented Nov 12, 2018

@luigidellaquila

Thanks for the fast reply.

I know you folks are swamped with work, but I was just wondering if you foresee this being added at some point in the future? I ask because I'm trying to determine if we should implement the current workaround we have for achieving this functionality, or hold off for a bit.

Thanks for all of your amazing work.

@smolinari
Copy link
Contributor

smolinari commented Nov 12, 2018

@luigidellaquila - UPSERT isn't documented in UPDATE EDGE for 3.0 or 3.1. Should I add that to my list of changes for the docs I already said I'd do? 😃

Scott

@luigidellaquila
Copy link
Member

Hi @smolinari

Thank you very much, I saw it and added it to my TODO list already, but if you have a chance to do it, it will be very appreciated ;-)

Thanks

Luigi

@Eric24
Copy link

Eric24 commented Dec 13, 2018

The current implementation is definitely useful as a way to easily prevent duplicate edges between the same two vertexes, but I agree that UPSERT should work as described by the OP.

@AndreiSoroka
Copy link

AndreiSoroka commented Feb 17, 2019

my temporary solve:

./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; TRUNCATE CLASS GroupToUser unsafe;" > /dev/null;
echo "removed GroupToUser: OK"
./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; TRUNCATE CLASS UserToGroupunsafe" > /dev/null;
echo "removed UserToGroup: OK"
echo "Start..."
./bin/console.sh "connect remote:localhost/SN1 root rootpwdasdf; set ignoreErrors true; load script ./source/groupsUsers.osql" > ./source/logfile.txt;

set ignoreErrors true; – is very important
after then need rebuild index and all is ok

We are use CREARE EDGE

@AndreiSoroka
Copy link

I not try, but found it: http://orientdb.com/docs/3.1.x/console/Console-Command-Repair-Database.html
Maybe can help. Not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

8 participants