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

Enable piped var being yield in FETCH PROP #3984

Open
wey-gu opened this issue Mar 8, 2022 · 1 comment
Open

Enable piped var being yield in FETCH PROP #3984

wey-gu opened this issue Mar 8, 2022 · 1 comment
Labels
good first issue Community: perfect as the first pull request type/enhancement Type: make the code neat or more efficient

Comments

@wey-gu
Copy link
Contributor

wey-gu commented Mar 8, 2022

Introduction

Minimal reproduce:

(root@nebula) [basketballplayer]> YIELD "player100" AS foo | FETCH PROP ON * $-.foo YIELD vertex as v,
+----------------------------------------------------+
| v                                                  |
+----------------------------------------------------+
| ("player100" :player{age: 42, name: "Tim Duncan"}) |
+----------------------------------------------------+
Got 1 rows (time spent 1736/47438 us)


(root@nebula) [basketballplayer]> YIELD "player100" AS foo | FETCH PROP ON * $-.foo YIELD vertex as v, $-.foo as foo
[ERROR (-1009)]: SemanticError: unsupported input/variable property expression in yield.

The second pattern would enable the user to do prop fetch with the original order(where we lost the order, for now).

See an example of this:
the properties($-.post) were chosen to FETCH in the end rather than in the head sentence due to it being much cheaper(in case properties per vertex are much bigger) to fetch after the aggregation, but in this case, the order was lost.

GO FROM "user-100" OVER click YIELD click._dst AS post, click._rank AS rank | LIMIT 10000 |
GROUP BY $-.post YIELD $-.post AS post, sum($-.rank) AS rank | 
ORDER BY $-.rank DESC | LIMIT 100 |
FETCH PROP ON * $-.post YIELD vertex AS v

Nebula could help here on:

  • opt 1: ensure FETCH ON * $-.post ordered from the array of $-.post
  • opt 2: support YIELD "player100" AS foo, 1 AS rank | FETCH PROP ON * $-.foo YIELD vertex as v, $-.rank AS rank

Contents

ref: https://discuss.nebula-graph.io/t/fetch-prop-keep-sorting-order/1183/

Related work

n/a

@wey-gu
Copy link
Contributor Author

wey-gu commented Apr 21, 2022

context: https://discuss.nebula-graph.io/t/hardcoded-pre-defined-string-as-input-to-a-ngql-extension-style-composite-query/1199
cc @jamieliu1023 @MuYiYong

@wey-gu wey-gu added the good first issue Community: perfect as the first pull request label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Community: perfect as the first pull request type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

1 participant