Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better error msg for query vector with wrong dim #1140

Merged
merged 2 commits into from
Mar 21, 2024
Merged

Conversation

QianZhu
Copy link
Contributor

@QianZhu QianZhu commented Mar 20, 2024

No description provided.

Copy link
Contributor

@westonpace westonpace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor readability suggestion but feel free to go on without it. Thanks for working on this!

Comment on lines 1188 to 1195
if !matches!(field.data_type(), arrow_schema::DataType::FixedSizeList(f, dim) if f.data_type().is_floating() && dim == query_vector.len() as i32)
{
return Err(Error::Schema {
let schema_vec_dim =
if let arrow_schema::DataType::FixedSizeList(_, dim) = field.data_type() {
dim
} else {
unreachable!()
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little hard to follow. Maybe it would be easier now to just do..

if let arrow_schema::DataType::FixedSizeList(f, dim) = field.data_type()) {
  if !f.data_type.is_floating() {
    // Error, not a float
  } else if dim != query_vector.len() {
    // Error, not correct dimension
  }
} else {
  // Error, not a fixed-size-list type
}

@QianZhu QianZhu merged commit 8f7ef26 into main Mar 21, 2024
8 checks passed
@QianZhu QianZhu deleted the query_vec_dim_error_msg branch March 21, 2024 04:01
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
alexkohler pushed a commit to alexkohler/lancedb that referenced this pull request Apr 20, 2024
…old files (lancedb#1140)

* Added support for a cleanup_old_versions function which will remove expired files from a dataset

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants