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

add annotation to some examples of comparison clause #2417

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs-2.0-zh/3.ngql-guide/5.operators/1.comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,23 @@ nebula> YIELD 1 != '1';
### `IS [NOT] NULL`

```ngql
# 返回关于 null 的一些判断结果。
nebula> RETURN null IS NULL AS value1, null == null AS value2, null != null AS value3;
+--------+----------+----------+
| value1 | value2 | value3 |
+--------+----------+----------+
| true | __NULL__ | __NULL__ |
+--------+----------+----------+

# 返回关于 NULL 的一些属性信息。
nebula> RETURN length(NULL), size(NULL), count(NULL), NULL IS NULL, NULL IS NOT NULL, sin(NULL), NULL + NULL, [1, NULL] IS NULL;
+--------------+------------+-------------+--------------+------------------+-----------+-------------+------------------+
| length(NULL) | size(NULL) | count(NULL) | NULL IS NULL | NULL IS NOT NULL | sin(NULL) | (NULL+NULL) | [1,NULL] IS NULL |
+--------------+------------+-------------+--------------+------------------+-----------+-------------+------------------+
| __NULL__ | __NULL__ | 0 | true | false | __NULL__ | __NULL__ | false |
+--------------+------------+-------------+--------------+------------------+-----------+-------------+------------------+

# 创建 map 数据,判断 map 的 name 属性是否不为 NULL。
nebula> WITH {name: null} AS `map` \
RETURN `map`.name IS NOT NULL;
+----------------------+
Expand All @@ -141,6 +144,7 @@ nebula> WITH {name: null} AS `map` \
| false |
+----------------------+

# 创建 map1、map2、map3 的数据,并判断返回其 name 属性是否为 NULL。
nebula> WITH {name: 'Mats', name2: 'Pontus'} AS map1, \
{name: null} AS map2, {notName: 0, notName2: null } AS map3 \
RETURN map1.name IS NULL, map2.name IS NOT NULL, map3.name IS NULL;
Expand All @@ -150,6 +154,7 @@ nebula> WITH {name: 'Mats', name2: 'Pontus'} AS map1, \
| false | false | true |
+-------------------+-----------------------+-------------------+

# 查询所有 Tag 为 player 的点数据,判断并返回点的 age 属性是否为 NULL、name 属性是否不为 NULL、empty 属性是否为 NULL。
nebula> MATCH (n:player) \
RETURN n.player.age IS NULL, n.player.name IS NOT NULL, n.player.empty IS NULL;
+----------------------+---------------------------+------------------------+
Expand All @@ -163,20 +168,23 @@ nebula> MATCH (n:player) \
### `IS [NOT] EMPTY`

```ngql
# 判断 null 是否不存在。
nebula> RETURN null IS EMPTY;
+---------------+
| NULL IS EMPTY |
+---------------+
| false |
+---------------+

# 判断 a 字符串是否存在。
nebula> RETURN "a" IS NOT EMPTY;
+------------------+
| "a" IS NOT EMPTY |
+------------------+
| true |
+------------------+

# 遍历所有 player100 指向的目的点,并返回目的点数据 name 属性存在的点 id。
nebula> GO FROM "player100" OVER * WHERE properties($$).name IS NOT EMPTY YIELD dst(edge);
+-------------+
| dst(EDGE) |
Expand Down