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(java): support overwrite for spark connector #3313

Merged
merged 5 commits into from
Jan 1, 2025

Conversation

SaintBacchus
Copy link
Collaborator

support overwrite for lance spark connector

df.write
  .format("lance")
  .option("path", "s3://lance/demo.lance")
  .mode("overwrite")
  .save()

@github-actions github-actions bot added enhancement New feature or request java labels Dec 30, 2024
@@ -54,7 +54,11 @@ public static LanceFragmentScanner create(
LanceConfig config = inputPartition.getConfig();
ReadOptions options = SparkOptions.genReadOptionFromConfig(config);
dataset = Dataset.open(allocator, config.getDatasetUri(), options);
fragment = dataset.getFragments().get(fragmentId);
fragment =
dataset.getFragments().stream()
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 O(n) operation? is it sensitive to the performance here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we want to use an O(1) operation to get the fragment, it has to build the dataset.getFragments() as a hash table and store it in the LanceInputPartition.

The LanceInputPartition will be serialized in spark and it will cause a lot of memory for a big lance dataset. So I think maybe the O(n) filter is a suitable way here.

@eddyxu eddyxu merged commit 33c45c8 into lancedb:main Jan 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants