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

sensitivity of function name #637

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ nebula> show spaces;
nebula> SHOW SPACES;
nebula> SHOW spaces;
nebula> show SPACES;
```
```

## 函数不区分大小写

函数名称不区分大小写,例如`count()`、`COUNT()`、`couNT()`是等价的。

```ngql
nebula> WITH [NULL, 1, 1, 2, 2] As a UNWIND a AS b RETURN count(b), COUNT(*), couNT(DISTINCT b);
+----------+----------+-------------------+
| count(b) | COUNT(*) | couNT(distinct b) |
+----------+----------+-------------------+
| 4 | 5 | 2 |
+----------+----------+-------------------+
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ nebula> LOOKUP ON player WHERE WILDCARD(player.name, "*ri*") YIELD player.name,

nebula> LOOKUP ON player WHERE WILDCARD(player.name, "*ri*") | YIELD count(*);
+----------+
| COUNT(*) |
| count(*) |
+----------+
| 3 |
+----------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ nebula> UNWIND [1, 2, 1] AS a \
nebula> UNWIND [1, 2, 1] AS a \
RETURN collect(a);
+------------+
| COLLECT(a) |
| collect(a) |
+------------+
| [1, 2, 1] |
+------------+

nebula> UNWIND [1, 2, 1] AS a \
RETURN a, collect(a), size(collect(a));
+---+------------+------------------+
| a | COLLECT(a) | size(COLLECT(a)) |
| a | collect(a) | size(COLLECT(a)) |
+---+------------+------------------+
| 2 | [2] | 1 |
+---+------------+------------------+
Expand All @@ -43,7 +43,7 @@ nebula> UNWIND ["c", "b", "a", "d" ] AS p \
ORDER BY q DESC LIMIT 3 \
RETURN collect(q);
+-----------------+
| COLLECT(q) |
| collect(q) |
+-----------------+
| ["d", "c", "b"] |
+-----------------+
Expand All @@ -61,7 +61,7 @@ nebula> WITH [1, 1, 2, 2] AS coll \
nebula> MATCH (n:player) \
RETURN collect(n.age);
+---------------------------------------------------------------+
| COLLECT(n.age) |
| collect(n.age) |
----------------------------------------------------------------+
| [32, 32, 34, 29, 41, 40, 33, 25, 40, 37, ...
...
Expand Down
12 changes: 6 additions & 6 deletions docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ count({expr | *})
nebula> WITH [NULL, 1, 1, 2, 2] As a UNWIND a AS b \
RETURN count(b), count(*), count(DISTINCT b);
+----------+----------+-------------------+
| COUNT(b) | COUNT(*) | COUNT(distinct b) |
| count(b) | count(*) | count(distinct b) |
+----------+----------+-------------------+
| 4 | 5 | 2 |
+----------+----------+-------------------+
Expand All @@ -36,7 +36,7 @@ nebula> GO FROM "player101" OVER follow BIDIRECT \
YIELD $$.player.name AS Name \
| GROUP BY $-.Name YIELD $-.Name, count(*);
+---------------------+----------+
| $-.Name | COUNT(*) |
| $-.Name | count(*) |
+---------------------+----------+
| "Dejounte Murray" | 1 |
+---------------------+----------+
Expand All @@ -56,9 +56,9 @@ nebula> GO FROM "player101" OVER follow BIDIRECT \

- `$-.Name`:查询结果包含的姓名。

- `COUNT(*)`:姓名出现的次数。
- `count(*)`:姓名出现的次数。

因为测试数据集`basketballplayer`中没有重复的姓名,`COUNT(*)`列中数字`2`表示该行的人和`player101`是互相`follow`的关系。
因为测试数据集`basketballplayer`中没有重复的姓名,`count(*)`列中数字`2`表示该行的人和`player101`是互相`follow`的关系。

```ngql
# 方法一:统计数据库中的年龄分布情况。
Expand Down Expand Up @@ -107,7 +107,7 @@ nebula> MATCH (n:player) \
nebula> MATCH (v:player{name:"Tim Duncan"}) -- (v2) \
RETURN count(DISTINCT v2);
+--------------------+
| COUNT(distinct v2) |
| count(distinct v2) |
+--------------------+
| 11 |
+--------------------+
Expand All @@ -116,7 +116,7 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) -- (v2) \
nebula> MATCH (n:player {name : "Tim Duncan"})-[]->(friend:player)-[]->(fof:player) \
RETURN count(fof), count(DISTINCT fof);
+------------+---------------------+
| COUNT(fof) | COUNT(distinct fof) |
| count(fof) | count(distinct fof) |
+------------+---------------------+
| 4 | 3 |
+------------+---------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) \
nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2:player) \
RETURN DISTINCT v2 AS Friends, count(v2);
+-----------------------------------------------------------+-----------+
| Friends | COUNT(v2) |
| Friends | count(v2) |
+-----------------------------------------------------------+-----------+
| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 |
+-----------------------------------------------------------+-----------+
Expand All @@ -461,7 +461,7 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2:player) \
nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*0..3]->(v2:player) \
RETURN DISTINCT v2 AS Friends, count(v2);
+-----------------------------------------------------------+-----------+
| Friends | COUNT(v2) |
| Friends | count(v2) |
+-----------------------------------------------------------+-----------+
| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 |
+-----------------------------------------------------------+-----------+
Expand Down
4 changes: 2 additions & 2 deletions docs-2.0/3.ngql-guide/7.general-query-statements/7.unwind.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ nebula> WITH [1,1,2,2,3,3] AS n \
ORDER BY r \
RETURN collect(r);
+------------+
| COLLECT(r) |
| collect(r) |
+------------+
| [1, 2, 3] |
+------------+
Expand All @@ -63,7 +63,7 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})--(v2) \
WITH DISTINCT r AS r \
RETURN collect(r);
+----------------------------------------------------------------------------------------------------------------------+
| COLLECT(r) |
| collect(r) |
+----------------------------------------------------------------------------------------------------------------------+
| [("player100" :player{age: 42, name: "Tim Duncan"}), ("player101" :player{age: 36, name: "Tony Parker"}),
("team204" :team{name: "Spurs"}), ("player102" :player{age: 33, name: "LaMarcus Aldridge"}),
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/8.clauses-and-options/with.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ nebula> MATCH (v:player) \
LIMIT 3 \
RETURN collect(Name);
+-----------------------------------------------+
| COLLECT(Name) |
| collect(Name) |
+-----------------------------------------------+
| ["Yao Ming", "Vince Carter", "Tracy McGrady"] |
+-----------------------------------------------+
Expand Down