列表运算符

Nebula Graph支持使用列表(List)运算符进行运算。支持的运算符如下。

名称说明
+连接列表。
IN元素是否存在于列表中。
[]使用下标操作符访问列表中的元素。

示例

  1. nebula> YIELD [1,2,3,4,5]+[6,7] AS myList;
  2. +-----------------------+
  3. | myList |
  4. +-----------------------+
  5. | [1, 2, 3, 4, 5, 6, 7] |
  6. +-----------------------+
  7. nebula> RETURN size([NULL, 1, 2]);
  8. +------------------+
  9. | size([NULL,1,2]) |
  10. +------------------+
  11. | 3 |
  12. +------------------+
  13. nebula> RETURN NULL IN [NULL, 1];
  14. +--------------------+
  15. | (NULL IN [NULL,1]) |
  16. +--------------------+
  17. | true |
  18. +--------------------+
  19. nebula> WITH [2, 3, 4, 5] AS numberlist \
  20. UNWIND numberlist AS number \
  21. WITH number \
  22. WHERE number IN [2, 3, 8] \
  23. RETURN number;
  24. +--------+
  25. | number |
  26. +--------+
  27. | 2 |
  28. +--------+
  29. | 3 |
  30. +--------+
  31. nebula> WITH ['Anne', 'John', 'Bill', 'Diane', 'Eve'] AS names RETURN names[1] AS result;
  32. +--------+
  33. | result |
  34. +--------+
  35. | "John" |
  36. +--------+