mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 14:46:56 +08:00
Added comments [skip ci]
This commit is contained in:
@@ -539,6 +539,7 @@ sparsevec_recv(PG_FUNCTION_ARGS)
|
|||||||
result = InitSparseVector(dim, nnz);
|
result = InitSparseVector(dim, nnz);
|
||||||
values = SPARSEVEC_VALUES(result);
|
values = SPARSEVEC_VALUES(result);
|
||||||
|
|
||||||
|
/* Binary representation uses zero-based numbering for indices */
|
||||||
for (int i = 0; i < nnz; i++)
|
for (int i = 0; i < nnz; i++)
|
||||||
{
|
{
|
||||||
result->indices[i] = pq_getmsgint(buf, sizeof(int32));
|
result->indices[i] = pq_getmsgint(buf, sizeof(int32));
|
||||||
@@ -549,6 +550,7 @@ sparsevec_recv(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
values[i] = pq_getmsgfloat4(buf);
|
values[i] = pq_getmsgfloat4(buf);
|
||||||
CheckElement(values[i]);
|
CheckElement(values[i]);
|
||||||
|
|
||||||
if (values[i] == 0)
|
if (values[i] == 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATA_EXCEPTION),
|
(errcode(ERRCODE_DATA_EXCEPTION),
|
||||||
@@ -573,8 +575,11 @@ sparsevec_send(PG_FUNCTION_ARGS)
|
|||||||
pq_sendint(&buf, svec->dim, sizeof(int32));
|
pq_sendint(&buf, svec->dim, sizeof(int32));
|
||||||
pq_sendint(&buf, svec->nnz, sizeof(int32));
|
pq_sendint(&buf, svec->nnz, sizeof(int32));
|
||||||
pq_sendint(&buf, svec->unused, sizeof(int32));
|
pq_sendint(&buf, svec->unused, sizeof(int32));
|
||||||
|
|
||||||
|
/* Binary representation uses zero-based numbering for indices */
|
||||||
for (int i = 0; i < svec->nnz; i++)
|
for (int i = 0; i < svec->nnz; i++)
|
||||||
pq_sendint(&buf, svec->indices[i], sizeof(int32));
|
pq_sendint(&buf, svec->indices[i], sizeof(int32));
|
||||||
|
|
||||||
for (int i = 0; i < svec->nnz; i++)
|
for (int i = 0; i < svec->nnz; i++)
|
||||||
pq_sendfloat4(&buf, values[i]);
|
pq_sendfloat4(&buf, values[i]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user