vesoft-inc / nebula

A distributed, fast open-source graph database featuring horizontal scalability and high availability
https://nebula-graph.io
Apache License 2.0
10.78k stars 1.2k forks source link

Filtering on SHOW QUERIES results #2875

Closed randomJoe211 closed 3 years ago

randomJoe211 commented 3 years ago

Nebula Graph version: 2.5.0

(root@nebula) [basketballplayer]> SHOW QUERIES | ORDER BY $-.StartTime Desc | Limit 10
+------------------+-----------------+--------+--------------------+----------------------------+----------------+-----------+--------------------------------------------------------+
| SessionID        | ExecutionPlanID | User   | Host               | StartTime                  | DurationInUSec | Status    | Query                                                  |
+------------------+-----------------+--------+--------------------+----------------------------+----------------+-----------+--------------------------------------------------------+
| 1631710188630519 | 25              | "root" | ""127.0.0.1":9669" | 2021-09-15T12:57:06.977388 | 0              | "RUNNING" | "SHOW QUERIES | ORDER BY $-.StartTime Desc | Limit 10" |
+------------------+-----------------+--------+--------------------+----------------------------+----------------+-----------+--------------------------------------------------------+
Got 1 rows (time spent 388/932 us)

Wed, 15 Sep 2021 12:57:06 UTC

(root@nebula) [basketballplayer]> SHOW QUERIES | ORDER BY $-.Status Desc | Limit 10
[ERROR (-1009)]: SemanticError: `$-.status', not exist prop `status'

Wed, 15 Sep 2021 12:57:20 UTC

(root@nebula) [basketballplayer]> SHOW QUERIES | ORDER BY $-.Host Desc | Limit 10
[ERROR (-1009)]: SemanticError: `$-.host', not exist prop `host'

Nebula Graph allows ordering/filtering on the SessionID, ExecutionPlanID, StartTime, and DurationInUSec fields, but does not allow ordering/filtering on the User, Host, Status, and Query fields. Why?

yixinglu commented 3 years ago

It seems that Status and Host are keywords in nebula graph. and keywords will be converted to lower case in parser, so sematic checks complain the error of not found the $-.host when you try to use the $-.Host.

We should avoid to use the keywords as the table header or use the lower case words as the header name, what do you think about this @CPWstatic ?

CPWstatic commented 3 years ago
Please know that host,status,query are keywords, use $-.`Status` instead.