1
0
mirror of https://github.com/tensorchord/pgvecto.rs.git synced 2025-08-08 14:22:07 +03:00

chore: fix typos (#228)

Signed-off-by: Keming <kemingyang@tensorchord.ai>
This commit is contained in:
Keming
2024-01-04 14:24:45 +08:00
committed by GitHub
parent 16af21314b
commit eb44c263b6
19 changed files with 56 additions and 32 deletions

22
.github/workflows/typos.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Typos check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
workflow_dispatch:
jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling of file.txt
uses: crate-ci/typos@master
with:
config: .typos.toml

2
.typos.toml Normal file
View File

@@ -0,0 +1,2 @@
[default.extend-words]
ND = "ND"

View File

@@ -86,7 +86,7 @@ class PGVectoRs:
Returns:
-------
List of records and coresponding distances.
List of records and corresponding distances.
"""
with Session(self._engine) as session:

View File

@@ -45,7 +45,7 @@ def test_create_index(conn: Connection, index_name: str, index_setting: str):
conn.commit()
# The server cannot handle invalid vectors curently, see https://github.com/tensorchord/pgvecto.rs/issues/96
# The server cannot handle invalid vectors currently, see https://github.com/tensorchord/pgvecto.rs/issues/96
# def test_invalid_insert(conn: Connection):
# for i, e in enumerate(INVALID_VECTORS):
# try:

View File

@@ -132,7 +132,7 @@ impl Worker {
view.flush();
Ok(())
}
pub fn call_destory(&self, handle: Handle) {
pub fn call_destroy(&self, handle: Handle) {
let mut protect = self.protect.lock();
if protect.indexes.remove(&handle).is_some() {
protect.maintain(&self.view);

View File

@@ -60,7 +60,7 @@ SELECT * FROM items ORDER BY embedding <-> '[3,2,1]' LIMIT 5;
## Half-precision floating-point
`vecf16` type is the same with `vector` in anything but the scalar type. It stores 16-bit floating point numbers. If you want to reduce the memory usage to get better performace, you can try to replace `vector` type with `vecf16` type.
`vecf16` type is the same with `vector` in anything but the scalar type. It stores 16-bit floating point numbers. If you want to reduce the memory usage to get better performance, you can try to replace `vector` type with `vecf16` type.
## Things You Need to Know

View File

@@ -15,7 +15,7 @@ DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;
```
To acheive full performance, please mount the volume to pg data directory by adding the option like `-v $PWD/pgdata:/var/lib/postgresql/data`
To achieve full performance, please mount the volume to pg data directory by adding the option like `-v $PWD/pgdata:/var/lib/postgresql/data`
You can configure PostgreSQL by the reference of the parent image in https://hub.docker.com/_/postgres/.

View File

@@ -12,13 +12,13 @@ If `vectors.k` is set to `64`, but your SQL returned less than `64` rows, for ex
* Less than `64` rows should be returned. It's expected.
* The vector index returned `64` rows, but `32` of which are deleted before but the index do not know since PostgreSQL vacuum is lazy.
* The vector index returned `64` rows, but `32` of which are invisble to the transaction so PostgreSQL decided to hide these rows for you.
* The vector index returned `64` rows, but `32` of which are satifying the condition `id % 2 = 0` in `WHERE` clause.
* The vector index returned `64` rows, but `32` of which are invisible to the transaction so PostgreSQL decided to hide these rows for you.
* The vector index returned `64` rows, but `32` of which are satisfying the condition `id % 2 = 0` in `WHERE` clause.
There are four ways to solve the problem:
* Set `vectors.k` larger. If you estimate that 20% of rows will satisfy the condition in `WHERE`, just set `vectors.k` to be 5 times than before.
* Set `vectors.enable_vector_index` to `off`. If you estimate that 0.0001% of rows will satisfy the condition in `WHERE`, just do not use vector index. No alogrithms will be faster than brute force by PostgreSQL.
* Set `vectors.enable_vector_index` to `off`. If you estimate that 0.0001% of rows will satisfy the condition in `WHERE`, just do not use vector index. No algorithms will be faster than brute force by PostgreSQL.
* Set `vectors.enable_prefilter` to `on`. If you cannot estimate how many rows will satisfy the condition in `WHERE`, leave the job for the index. The index will check if the returned row can be accepted by PostgreSQL. However, it will make queries slower so the default value for this option is `off`.
* Set `vectors.enable_vbase` to `on`. It will use vbase optimization, so that the index will pull rows as many as you need. It only works for HNSW algorithm.

View File

@@ -98,8 +98,8 @@ fn session(worker: Arc<Worker>, mut handler: RpcHandler) -> Result<(), IpcError>
Ok(()) => handler = x.leave()?,
Err(e) => x.reset(e)?,
},
RpcHandle::Destory { handle, x } => {
worker.call_destory(handle);
RpcHandle::Destroy { handle, x } => {
worker.call_destroy(handle);
handler = x.leave()?;
}
RpcHandle::Stat { handle, x } => match worker.call_stat(handle) {

View File

@@ -60,7 +60,7 @@ fn session(handler: RpcHandler) -> Result<(), IpcError> {
RpcHandle::Insert { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Delete { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Flush { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Destory { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Destroy { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Stat { x, .. } => x.reset(FriendlyError::Upgrade)?,
RpcHandle::Vbase { x, .. } => x.reset(FriendlyError::Upgrade)?,
}

View File

@@ -310,7 +310,7 @@ fn vecf16_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf16Output {
(_, b' ') => {}
_ => {
FriendlyError::BadLiteral {
hint: format!("Bad charactor with ascii {:#x}.", c),
hint: format!("Bad character with ascii {:#x}.", c),
}
.friendly();
}

View File

@@ -310,7 +310,7 @@ fn vecf32_in(input: &CStr, _oid: Oid, typmod: i32) -> Vecf32Output {
(_, b' ') => {}
_ => {
FriendlyError::BadLiteral {
hint: format!("Bad charactor with ascii {:#x}.", c),
hint: format!("Bad character with ascii {:#x}.", c),
}
.friendly();
}

View File

@@ -2,7 +2,7 @@ use crate::index::am_scan::Scanner;
use std::ptr::null_mut;
pub unsafe fn post_executor_start(query_desc: *mut pgrx::pg_sys::QueryDesc) {
// Before Postgres 16, type defination of `PlanstateTreeWalker` in the source code is incorrect.
// Before Postgres 16, type definition of `PlanstateTreeWalker` in the source code is incorrect.
let planstate = (*query_desc).planstate;
let context = null_mut();
rewrite_plan_state(planstate, context);

View File

@@ -48,7 +48,7 @@ unsafe fn xact_delete() {
.collect::<Vec<_>>();
let mut rpc = crate::ipc::client::borrow_mut();
for handle in handles {
rpc.destory(handle);
rpc.destroy(handle);
}
}
}
@@ -65,7 +65,7 @@ unsafe fn xact_delete() {
.collect::<Vec<_>>();
let mut rpc = crate::ipc::client::borrow_mut();
for handle in handles {
rpc.destory(handle);
rpc.destroy(handle);
}
}
}

View File

@@ -113,10 +113,10 @@ impl ClientGuard<Rpc> {
self.socket.send(packet).friendly();
let flush::FlushPacket::Leave {} = self.socket.recv().friendly();
}
pub fn destory(&mut self, handle: Handle) {
let packet = RpcPacket::Destory { handle };
pub fn destroy(&mut self, handle: Handle) {
let packet = RpcPacket::Destroy { handle };
self.socket.send(packet).friendly();
let destory::DestoryPacket::Leave {} = self.socket.recv().friendly();
let destroy::DestroyPacket::Leave {} = self.socket.recv().friendly();
}
pub fn stat(&mut self, handle: Handle) -> IndexStat {
let packet = RpcPacket::Stat { handle };

View File

@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub enum DestoryPacket {
pub enum DestroyPacket {
Leave {},
}

View File

@@ -1,6 +1,6 @@
pub mod create;
pub mod delete;
pub mod destory;
pub mod destroy;
pub mod flush;
pub mod insert;
pub mod search;
@@ -21,7 +21,7 @@ pub enum RpcPacket {
Delete {
handle: Handle,
},
Destory {
Destroy {
handle: Handle,
},
Flush {

View File

@@ -56,9 +56,9 @@ impl RpcHandler {
socket: self.socket,
},
},
RpcPacket::Destory { handle } => RpcHandle::Destory {
RpcPacket::Destroy { handle } => RpcHandle::Destroy {
handle,
x: Destory {
x: Destroy {
socket: self.socket,
},
},
@@ -105,9 +105,9 @@ pub enum RpcHandle {
handle: Handle,
x: Flush,
},
Destory {
Destroy {
handle: Handle,
x: Destory,
x: Destroy,
},
Stat {
handle: Handle,
@@ -218,13 +218,13 @@ impl Flush {
}
}
pub struct Destory {
pub struct Destroy {
socket: ServerSocket,
}
impl Destory {
impl Destroy {
pub fn leave(mut self) -> Result<RpcHandler, IpcError> {
let packet = destory::DestoryPacket::Leave {};
let packet = destroy::DestroyPacket::Leave {};
self.socket.ok(packet)?;
Ok(RpcHandler {
socket: self.socket,

View File

@@ -4,7 +4,7 @@ SELECT '[1,2,3]'::vector;
----
[1, 2, 3]
statement error Bad charactor
statement error Bad character
SELECT '{1,2,3}'::vector;
# cast array to vector
@@ -61,10 +61,10 @@ SELECT '[]'::vector;
statement error Bad sequence
SELECT '[1,2,3'::vector;
statement error Bad charactor
statement error Bad character
SELECT '[1,2,3]9'::vector;
statement error Bad charactor
statement error Bad character
SELECT '1,2,3'::vector;
statement error Bad sequence