map怎么用?

  • nebula 版本:2.0-nightly, docker image digest: 956b0098c5d0961617616b400d9fbc3cb91f815278477a4622a643037f9c77a8
  • 部署方式(分布式 / 单机 / Docker / DBaaS): docker
  • 硬件信息
    • 磁盘: SSD
    • AMD Ryzen Threadripper 2990WX, RAM: 126GB

文档提到map:

map(fun, iter) | Returns a map object after applying the given function to each item of a given iterable.

能不能提供一些范例? 尝试了以下:

return map(radians, n in [1, 2, 3])
return map(radians, range(1, 10))

报错:

[ERROR (-7)]: SyntaxError: Unknown function  near `map'

文档在这里: https://github.com/vesoft-inc/nebula-docs/blob/4a2966e60fd694f0b550b176e56ef80fd4ebe9ab/docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md

map的描述可参考文档 映射 - Nebula Graph Database 内核手册

不好意思, 我可能没表达清楚. 问题中提到的map是指map/filter/reduce的那个map, 而不是键值对.

map(fun, iter) | Returns a map object after applying the given function to each item of a given iterable.

你从哪个文档看到的这个函数?不记得有这个函数

文档在这里: nebula-docs/1.math.md at 4a2966e60fd694f0b550b176e56ef80fd4ebe9ab · vesoft-inc/nebula-docs · GitHub

你好,文档这里有误,NebulaGraph目前不支持map函数的。 @RandomJoe 这里文档帮忙更新下呀

虽然不支持这个map函数,但支持list comprehension函数,功能和这个map函数看起来比较接近. 文档还没补上 @RandomJoe . 具体用法你可以先参考测试用例: nebula-graph/ListComprehension.feature at master · vesoft-inc/nebula-graph · GitHub

嗯, list comprehension也不错. 谢谢.

列表 - Nebula Graph Database 内核手册 这里

1 个赞