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

Support edge CAS in arbitrary rank #3873

Open
wey-gu opened this issue Feb 10, 2022 · 3 comments
Open

Support edge CAS in arbitrary rank #3873

wey-gu opened this issue Feb 10, 2022 · 3 comments
Labels
type/enhancement Type: make the code neat or more efficient

Comments

@wey-gu
Copy link
Contributor

wey-gu commented Feb 10, 2022

Initial question: to update edge w/o knowing its rank.

insert edge follow(degree) values "player126"->"player116"@1:(13);
insert edge follow(degree) values "player126"->"player116"@2:(13);

UPDATE EDGE ON follow "player126"->"player116" SET degree = 1000 WHEN degree < 1000;

(root@nebula) [basketballplayer]> UPDATE EDGE ON follow "player126"->"player116" SET degree = 1000 WHEN degree < 1000;
[ERROR (-1005)]: Storage Error: Vertex or edge not found.

Wed, 09 Feb 2022 14:52:30 UTC

Options I could think of are as follows:

  1. Use variable or pipeline to fetch ranks and specify to update edge

This is not yet supported:

go from "player126" over follow WHERE dst(edge) == "player116" yield rank(edge) as r | UPDATE EDGE ON follow "player126"->"player116"@$-.r SET degree = 1000 WHEN degree < 1000

[ERROR (-1004)]: SyntaxError: syntax error near `UPDATE'
update_edge_sentence
    // ======== Begin: Compatible with 1.0 =========
    : KW_UPDATE KW_EDGE vid R_ARROW vid KW_OF name_label
      KW_SET update_list when_clause yield_clause {
        auto sentence = new UpdateEdgeSentence($3, $5, 0, $7, $9, $10, $11);
        $$ = sentence;
    }
    | KW_UPSERT KW_EDGE vid R_ARROW vid KW_OF name_label
      KW_SET update_list when_clause yield_clause {
        auto sentence = new UpdateEdgeSentence($3, $5, 0, $7, $9, $10, $11, true);
        $$ = sentence;
    }
    | KW_UPDATE KW_EDGE vid R_ARROW vid AT rank KW_OF name_label
      KW_SET update_list when_clause yield_clause {
        auto sentence = new UpdateEdgeSentence($3, $5, $7, $9, $11, $12, $13);
        $$ = sentence;
    }
    | KW_UPSERT KW_EDGE vid R_ARROW vid AT rank KW_OF name_label
      KW_SET update_list when_clause yield_clause {
        auto sentence = new UpdateEdgeSentence($3, $5, $7, $9, $11, $12, $13, true);
        $$ = sentence;

...

rank: unary_integer { $$ = $1; };

  1. Introduce wildcard rank i.e. @*
UPDATE EDGE ON follow "player126"->"player116"@* SET degree = 1000 WHEN degree < 1000;

Question

Could we support 1 or 2 or other options?

@wey-gu
Copy link
Contributor Author

wey-gu commented Feb 10, 2022

If either 1 or 2 is doable, I would like to take this task to learn C++ and contributing core ;)

@Sophie-Xie
Copy link
Contributor

If either 1 or 2 is doable, I would like to take this task to learn C++ and contributing core ;)

@CPWstatic Hello, what do you think?:)

@Sophie-Xie Sophie-Xie added the type/enhancement Type: make the code neat or more efficient label Feb 25, 2022
@sworduo
Copy link
Contributor

sworduo commented May 9, 2022

Maybe support rank comparison in where clause is better. Suppose an edge schema named test_edge, then rank(test_edge) indicates the rank of edge test_edge.
In this case, update specified edges can be written as
UPDATE EDGE ON "player126"->"player116" SET degree = 1000 WHEN degree < 1000 and rank(test_edge) >""
Futhermore, the following issue will be resolved toghther.
#3155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

3 participants