NebulaGraph 2.0 创建索引的语句,语法是不是变了?

提问参考模版:

  • nebula 版本:2.0 git 拉取
  • 部署方式(分布式 / 单机 / Docker / DBaaS):Docker Compose
  • 问题的具体描述: 按照官方文档操作后,在尝试创建index时,出现错误提示
  • 相关的 meta / storage / graph info 日志信息

TAG 定义

(root@nebula) [nba]> DESCRIBE TAG player;
+--------+----------+-------+---------+
| Field  | Type     | Null  | Default |
+--------+----------+-------+---------+
| "name" | "string" | "YES" |         |
+--------+----------+-------+---------+
| "age"  | "int64"  | "YES" |         |
+--------+----------+-------+---------+
Got 2 rows (time spent 9770/10636 us)

Fri, 26 Feb 2021 09:05:37 UTC

(root@nebula) [nba]> CREATE TAG INDEX player_index_0 on player(name);
[ERROR (-8)]: Invalid parm!

Fri, 26 Feb 2021 09:06:21 UTC

(root@nebula) [nba]> CREATE TAG INDEX 'player_index_0' on player(name);
[ERROR (-7)]: SyntaxError: syntax error near `' on pla'

Fri, 26 Feb 2021 09:06:28 UTC

(root@nebula) [nba]> CREATE TAG INDEX player_index_0 ON player(name);
[ERROR (-8)]: Invalid parm!

Fri, 26 Feb 2021 09:06:37 UTC

graphd log

E0226 08:13:36.901525    23 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 08:13:36.901741    23 QueryInstance.cpp:120] Invalid parm!
E0226 08:18:25.989981    22 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 08:18:25.990130    23 QueryInstance.cpp:120] Invalid parm!
E0226 08:51:48.273283    22 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 08:51:48.273399    23 QueryInstance.cpp:120] Invalid parm!
E0226 08:57:30.882784    22 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 08:57:30.882927    22 QueryInstance.cpp:120] Invalid parm!
E0226 08:58:17.581645    22 QueryInstance.cpp:120] SyntaxError: syntax error near `string'
E0226 08:59:05.084574    23 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 08:59:05.085119    23 QueryInstance.cpp:120] Invalid parm!
E0226 08:59:29.899621    22 QueryInstance.cpp:120] SyntaxError: syntax error near `player'
E0226 08:59:39.897305    22 QueryInstance.cpp:120] SyntaxError: syntax error near `player'
E0226 08:59:42.445792    22 QueryInstance.cpp:120] SyntaxError: syntax error near `player'
E0226 09:01:21.065579    22 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 09:01:21.065681    22 QueryInstance.cpp:120] Invalid parm!
E0226 09:05:31.518383    22 QueryInstance.cpp:120] SyntaxError: syntax error near `player'
E0226 09:05:53.267740    23 QueryInstance.cpp:120] SyntaxError: syntax error near `");'
E0226 09:05:58.832554    23 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 09:05:58.832679    23 QueryInstance.cpp:120] Invalid parm!
E0226 09:06:15.489928    22 QueryInstance.cpp:120] SyntaxError: syntax error near `INDEX'
E0226 09:06:21.430498    23 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 09:06:21.430672    23 QueryInstance.cpp:120] Invalid parm!
E0226 09:06:28.576709    23 QueryInstance.cpp:120] SyntaxError: syntax error near `' on pla'
E0226 09:06:37.238214    22 TagIndexExecutor.cpp:29] SpaceId: 1, Create index `player_index_0' at tag: `player' failed: Invalid parm!
E0226 09:06:37.238402    22 QueryInstance.cpp:120] Invalid parm!

为没有指定长度的变量属性创建索引时,需要指定索引长度。
CREATE TAG INDEX player_index_0 on player(name(10));

2赞

你好,想问一下在这种情况下,这个固定长度的索引怎么使用呢?比如你的这个例子里,如果 player 的 name 属性长度不到 10 的话,lookup 的时候条件怎么写呢?

@lzy

查询语句还是正常书写,长度不到10,就直接写实际值,底层是会处理。

1赞

浙ICP备20010487号