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

feat: add merge_insert to the node and rust APIs #915

Merged
merged 10 commits into from Feb 2, 2024

Conversation

westonpace
Copy link
Contributor

No description provided.

@westonpace westonpace marked this pull request as draft February 1, 2024 23:46
@westonpace
Copy link
Contributor Author

westonpace commented Feb 1, 2024

The unit tests will fail until lance can be upgraded to 0.9.12 due to lancedb/lance#1899

@westonpace westonpace marked this pull request as ready for review February 2, 2024 05:31
/// merge_insert.execute(Box::new(new_data)).await.unwrap();
/// # });
/// ```
fn merge_insert(&self, on: &[&str]) -> MergeInsertBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

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

why dont we just call it upsert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upsert has well defined semantics and is only a subset of merge insert. Merge insert can do upsert, insert-if-not-exists and replace-range. We could create an alias that sets the appropriate configuration and runs merge insert but we talked about it a bit in slack and decided not to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

More specifically:

Bulk Update

when_matched_update_all

Upsert

when_matched_update_all
when_not_matched_insert_all

Insert if not Exists

when_not_matched_insert_all

Replace Range

when_matched_update_all
when_not_matched_insert_all
when_not_matched_by_source_delete

Copy link
Contributor

Choose a reason for hiding this comment

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

And, to be clear, we didn't invent MERGE INSERT. It's an established operation in data warehouses:

@westonpace westonpace merged commit 7f8637a into lancedb:main Feb 2, 2024
16 checks passed
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
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

4 participants