vesoft-inc/nebula

Enable piped var being yield in FETCH PROP

Open

#3 984 ouverte le 8 mars 2022

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)C++ (1 144 forks)batch import
good first issuetype/enhancement

Métriques du dépôt

Stars
 (9 828 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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

Guide contributeur