7.15.38. vector_size#

7.15.38.1. Summary#

New in version 5.0.3.

vector_size returns the value of vector column size.

To enable this function, register functions/vector plugin by the following command:

plugin_register functions/vector

7.15.38.2. Syntax#

vector_size requires one argument - target.

vector_size(target)

7.15.38.3. Usage#

Here is a schema definition and sample data.

Sample schema:

Execution example:

plugin_register functions/vector
# [[0,1337566253.89858,0.000355720520019531],true]
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]

Sample data:

Execution example:

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.

Execution example:

select Memos --output_columns 'tags, vector_size(tags)'
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         3
#       ],
#       [
#         [
#           "tags",
#           "ShortText"
#         ],
#         [
#           "vector_size",
#           null
#         ]
#       ],
#       [
#         [
#           "Groonga"
#         ],
#         1
#       ],
#       [
#         [
#           "Groonga",
#           "Ruby"
#         ],
#         2
#       ],
#       [
#         [
#
#         ],
#         0
#       ]
#     ]
#   ]
# ]

7.15.38.4. Parameters#

There is only one required parameter.

7.15.38.4.1. target#

Specifies a vector column of table that is specified by table parameter in select.

7.15.38.5. Return value#

vector_size returns the value of target vector column size.