Star

关于SCAN的问题

  1. LOOKUP的文档中,我注意到Limitations of using WHERE in LOOKUP小节中提到了Range scan is not supported in the string-type index.其中的SCAN操作我不太明白,在文档中并没有找到对应部分,可否简单介绍一下呢?
  2. 我在nebula-python中找到了相关操作,是否SCAN就是遍历操作?

lookup和scan是两个接口,并没有啥关系。lookup那个就是需要底层去扫描一些数据(但是string在1.0不支持 >, <这些过滤条件,只支持等值,所以你能看到上面的报错)。

好的好的,但是我还有两点疑问:
1、 scan也是一种查询接口,是否有对应的查询语句?还是只在实现的底层使用呢?我还是不明白这个限制在我实际中会有什么影响。

2、 在1.0中不支持,这是2.0的文档,是不是意味着在2.0中并不存在此限制?

我突然想起来,昨天在上一个问题中,explain操作MATCH时,也看到了scan操作,当时就不太清楚,所以这里再仔细问一下 :pray:

(root@nebula) [yago]> EXPLAIN format="row" match (v: Person{name: "Donald_Trump"}) return v;
Execution succeeded (time spent 1281/2727 us)

Execution Plan

-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
| id | name        | dependencies | profiling data | operator info                                                                       |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  8 | Project     | 7            |                | outputVar: [{"colNames":["v"],"name":"__Project_8","type":"DATASET"}]               |
|    |             |              |                | inputVar: __Filter_7                                                                |
|    |             |              |                | columns: ["$v"]                                                                     |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  7 | Filter      | 6            |                | outputVar: [{"colNames":["v","__COL_0"],"name":"__Filter_7","type":"DATASET"}]      |
|    |             |              |                | inputVar: __Project_6                                                               |
|    |             |              |                | condition: (hasSameEdgeInPath($-.__COL_0)==false)                                   |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  6 | Project     | 5            |                | outputVar: [{"colNames":["v","__COL_0"],"name":"__Project_6","type":"DATASET"}]     |
|    |             |              |                | inputVar: __Project_5                                                               |
|    |             |              |                | columns: ["startNode($-._path) AS v","reversePath(PathBuild[$-._path]) AS __COL_0"] |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  5 | Project     | 4            |                | outputVar: [{"colNames":["_path"],"name":"__Project_5","type":"DATASET"}]           |
|    |             |              |                | inputVar: __Filter_4                                                                |
|    |             |              |                | columns: ["PathBuild[VERTEX]"]                                                      |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  4 | Filter      | 3            |                | outputVar: [{"colNames":[],"name":"__Filter_4","type":"DATASET"}]                   |
|    |             |              |                | inputVar: __GetVertices_3                                                           |
|    |             |              |                | condition: (VERTEX.name==Donald_Trump)                                              |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  3 | GetVertices | 2            |                | outputVar: [{"colNames":[],"name":"__GetVertices_3","type":"DATASET"}]              |
|    |             |              |                | inputVar: __Dedup_2                                                                 |
|    |             |              |                | space: 1                                                                            |
|    |             |              |                | dedup: false                                                                        |
|    |             |              |                | limit: 9223372036854775807                                                          |
|    |             |              |                | filter:                                                                             |
|    |             |              |                | orderBy: []                                                                         |
|    |             |              |                | src: $-._vid                                                                        |
|    |             |              |                | props: []                                                                           |
|    |             |              |                | exprs: []                                                                           |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  2 | Dedup       | 1            |                | outputVar: [{"colNames":["_vid"],"name":"__Dedup_2","type":"DATASET"}]              |
|    |             |              |                | inputVar: __Project_1                                                               |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
|  1 | Project     | 11           |                | outputVar: [{"colNames":["_vid"],"name":"__Project_1","type":"DATASET"}]            |
|    |             |              |                | inputVar: __IndexScan_0                                                             |
|    |             |              |                | columns: ["$_vid"]                                                                  |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
| 11 | IndexScan   | 10           |                | outputVar: [{"colNames":["_vid"],"name":"__IndexScan_0","type":"DATASET"}]          |
|    |             |              |                | inputVar:                                                                           |
|    |             |              |                | space: 1                                                                            |
|    |             |              |                | dedup: false                                                                        |
|    |             |              |                | limit: 9223372036854775807                                                          |
|    |             |              |                | filter:                                                                             |
|    |             |              |                | orderBy: []                                                                         |
|    |             |              |                | schemaId: 25                                                                        |
|    |             |              |                | isEdge: false                                                                       |
|    |             |              |                | returnCols: ["_vid"]                                                                |
|    |             |              |                | indexCtx: [{"columnHints":[],"index_id":339,"filter":""}]                           |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------
| 10 | Start       |              |                | outputVar: [{"colNames":[],"name":"__Start_10","type":"DATASET"}]                   |
-----+-------------+--------------+----------------+--------------------------------------------------------------------------------------

Wed, 13 Jan 2021 22:43:19 EST
  1. scan这个查询接口是用storage client直接连接storage的,一般不会使用
  2. 是的
  3. explain看到的IndexScan指的是lookup

好的好的,非常感谢!

浙ICP备20010487号