diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 0000000..1044210 --- /dev/null +++ b/.github/workflows/typos.yml @@ -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 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..a835b47 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +ND = "ND" diff --git a/bindings/python/src/pgvecto_rs/sdk/client.py b/bindings/python/src/pgvecto_rs/sdk/client.py index aed155b..b2991e0 100644 --- a/bindings/python/src/pgvecto_rs/sdk/client.py +++ b/bindings/python/src/pgvecto_rs/sdk/client.py @@ -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: diff --git a/bindings/python/tests/test_psycopg.py b/bindings/python/tests/test_psycopg.py index 07e3a92..6bf411c 100644 --- a/bindings/python/tests/test_psycopg.py +++ b/bindings/python/tests/test_psycopg.py @@ -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: diff --git a/crates/service/src/worker/mod.rs b/crates/service/src/worker/mod.rs index 0876278..344f18a 100644 --- a/crates/service/src/worker/mod.rs +++ b/crates/service/src/worker/mod.rs @@ -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); diff --git a/docs/get-started.md b/docs/get-started.md index 24b5ca3..6728143 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -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 diff --git a/docs/installation.md b/docs/installation.md index b38729f..27ce944 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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/. diff --git a/docs/searching.md b/docs/searching.md index 3c15dc0..7d9af32 100644 --- a/docs/searching.md +++ b/docs/searching.md @@ -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. diff --git a/src/bgworker/normal.rs b/src/bgworker/normal.rs index 30165fb..bff6fc0 100644 --- a/src/bgworker/normal.rs +++ b/src/bgworker/normal.rs @@ -98,8 +98,8 @@ fn session(worker: Arc, 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) { diff --git a/src/bgworker/upgrade.rs b/src/bgworker/upgrade.rs index b2086c8..6d70629 100644 --- a/src/bgworker/upgrade.rs +++ b/src/bgworker/upgrade.rs @@ -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)?, } diff --git a/src/datatype/vecf16.rs b/src/datatype/vecf16.rs index 556b2eb..81f8580 100644 --- a/src/datatype/vecf16.rs +++ b/src/datatype/vecf16.rs @@ -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(); } diff --git a/src/datatype/vecf32.rs b/src/datatype/vecf32.rs index 140e805..8db498a 100644 --- a/src/datatype/vecf32.rs +++ b/src/datatype/vecf32.rs @@ -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(); } diff --git a/src/index/hook_executor.rs b/src/index/hook_executor.rs index e11b2d2..ba972e0 100644 --- a/src/index/hook_executor.rs +++ b/src/index/hook_executor.rs @@ -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); diff --git a/src/index/hooks.rs b/src/index/hooks.rs index bcd9085..57a1e97 100644 --- a/src/index/hooks.rs +++ b/src/index/hooks.rs @@ -48,7 +48,7 @@ unsafe fn xact_delete() { .collect::>(); 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::>(); let mut rpc = crate::ipc::client::borrow_mut(); for handle in handles { - rpc.destory(handle); + rpc.destroy(handle); } } } diff --git a/src/ipc/client/mod.rs b/src/ipc/client/mod.rs index 04c4d7a..d82c5d5 100644 --- a/src/ipc/client/mod.rs +++ b/src/ipc/client/mod.rs @@ -113,10 +113,10 @@ impl ClientGuard { 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 }; diff --git a/src/ipc/packet/destory.rs b/src/ipc/packet/destroy.rs similarity index 79% rename from src/ipc/packet/destory.rs rename to src/ipc/packet/destroy.rs index 0c021ca..ecc802f 100644 --- a/src/ipc/packet/destory.rs +++ b/src/ipc/packet/destroy.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] -pub enum DestoryPacket { +pub enum DestroyPacket { Leave {}, } diff --git a/src/ipc/packet/mod.rs b/src/ipc/packet/mod.rs index 8797a8d..0fc7919 100644 --- a/src/ipc/packet/mod.rs +++ b/src/ipc/packet/mod.rs @@ -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 { diff --git a/src/ipc/server/mod.rs b/src/ipc/server/mod.rs index 0d12780..815d2f3 100644 --- a/src/ipc/server/mod.rs +++ b/src/ipc/server/mod.rs @@ -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 { - let packet = destory::DestoryPacket::Leave {}; + let packet = destroy::DestroyPacket::Leave {}; self.socket.ok(packet)?; Ok(RpcHandler { socket: self.socket, diff --git a/tests/sqllogictest/cast.slt b/tests/sqllogictest/cast.slt index 69dcdb7..8470a4d 100644 --- a/tests/sqllogictest/cast.slt +++ b/tests/sqllogictest/cast.slt @@ -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