Skip to content

Commit

Permalink
chore: fix typos (#228)
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy authored Jan 4, 2024
1 parent 16af213 commit eb44c26
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 32 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-words]
ND = "ND"
2 changes: 1 addition & 1 deletion bindings/python/src/pgvecto_rs/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def search(
Returns:
-------
List of records and coresponding distances.
List of records and corresponding distances.
"""
with Session(self._engine) as session:
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/tests/test_psycopg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion crates/service/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/.

Expand Down
6 changes: 3 additions & 3 deletions docs/searching.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/bgworker/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/bgworker/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
}
Expand Down
2 changes: 1 addition & 1 deletion src/datatype/vecf16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/datatype/vecf32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/index/hook_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/index/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand All @@ -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);
}
}
}
6 changes: 3 additions & 3 deletions src/ipc/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/packet/destory.rs → src/ipc/packet/destroy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub enum DestoryPacket {
pub enum DestroyPacket {
Leave {},
}
4 changes: 2 additions & 2 deletions src/ipc/packet/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,7 +21,7 @@ pub enum RpcPacket {
Delete {
handle: Handle,
},
Destory {
Destroy {
handle: Handle,
},
Flush {
Expand Down
14 changes: 7 additions & 7 deletions src/ipc/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down Expand Up @@ -105,9 +105,9 @@ pub enum RpcHandle {
handle: Handle,
x: Flush,
},
Destory {
Destroy {
handle: Handle,
x: Destory,
x: Destroy,
},
Stat {
handle: Handle,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/sqllogictest/cast.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb44c26

Please sign in to comment.