バージョン 5.0.3 で追加.
vector_size returns the value of vector column size.
To enable this function, register functions/vector plugin by following the command:
plugin_register functions/vector
Then, use vector_size function with --command_version 2 option.
使い方を示すために使うスキーマ定義とサンプルデータは以下の通りです。
サンプルスキーマ:
実行例:
table_create Memos TABLE_HASH_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Memos tags COLUMN_VECTOR ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
サンプルデータ:
実行例:
load --table Memos
[
{"_key": "Groonga", "tags": ["Groonga"]},
{"_key": "Rroonga", "tags": ["Groonga", "Ruby"]},
{"_key": "Nothing"}
]
# [[0, 1337566253.89858, 0.000355720520019531], 3]
Here is the simple usage of vector_size function which returns tags and size - the value of tags column and size of it.
実行例:
select Memos --output_columns 'tags, vector_size(tags)' --command_version 2
# [
# [
# 0,
# 1337566253.89858,
# 0.000355720520019531
# ],
# [
# [
# [
# 3
# ],
# [
# [
# "tags",
# "ShortText"
# ],
# [
# "vector_size",
# "Object"
# ]
# ],
# [
# [
# "Groonga"
# ],
# 1
# ],
# [
# [
# "Groonga",
# "Ruby"
# ],
# 2
# ],
# [
# [],
# 0
# ]
# ]
# ]
# ]
There is one required parameter, target.
Specifies a vector column of table that is specified by table parameter in select.
vector_size returns the value of target vector column size.