vesoft-inc/nebula

Enable piped var being yield in FETCH PROP

Open

#3,984 创建于 2022年3月8日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)C++ (1,144 fork)batch import
good first issuetype/enhancement

仓库指标

Star
 (9,828 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南