Skip to content

feat: support update/delete using MOR for spark3.5 - #79

Merged
jackye1995 merged 5 commits into
lance-format:mainfrom
fangbo:spark-update-mor
Sep 5, 2025
Merged

feat: support update/delete using MOR for spark3.5#79
jackye1995 merged 5 commits into
lance-format:mainfrom
fangbo:spark-update-mor

Conversation

@fangbo

@fangbo fangbo commented Aug 22, 2025

Copy link
Copy Markdown
Collaborator

Related Issue: #41 and #57

@github-actions

Copy link
Copy Markdown
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@fangbo fangbo changed the title [WIP] Support update using MOR [WIP] support update using MOR Aug 22, 2025
@fangbo fangbo changed the title [WIP] support update using MOR [WIP] support update using MOR for spark3.5 Aug 25, 2025
@fangbo fangbo changed the title [WIP] support update using MOR for spark3.5 [WIP]feat: support update using MOR for spark3.5 Aug 25, 2025
@fangbo fangbo changed the title [WIP]feat: support update using MOR for spark3.5 feat: support update using MOR for spark3.5 Aug 25, 2025
@github-actions github-actions Bot added the enhancement New feature or request label Aug 25, 2025
@fangbo fangbo changed the title feat: support update using MOR for spark3.5 [WIP] feat: support update using MOR for spark3.5 Aug 25, 2025
@fangbo
fangbo force-pushed the spark-update-mor branch 2 times, most recently from 71d41ab to 89c28ab Compare August 27, 2025 06:10
@fangbo fangbo changed the title [WIP] feat: support update using MOR for spark3.5 feat: support update using MOR for spark3.5 Sep 3, 2025
package com.lancedb.lance.spark;

public class LanceConstant {
public static final String SEGMENT_ID = "_segmentid";

@jackye1995 jackye1995 Sep 3, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like this should be named like FRAGMENT_ID = "_fragid"?

private final LanceDataWriter writer;

// Key is fragmentId, Value is fragment's deleted row indexes
private final Map<Integer, List<Integer>> deletedRows;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can use a TreeMap<Integer, RoaringBitmap> for better efficiency (basically equivalent to RoaringTreemap in rust.

}

@Test
public void testSparkSqlUpdate() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add more tests for various cases ,e.g. delete, update, touch a few rows, touch no rows, touch all rows, set scalar value, set struct/list value, set child field in a struct.

@fangbo

fangbo commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator Author

@jackye1995 Greatly appreciate for you suggestions! I have made some modifications and added more test cases (UpdateListTest, UpdateStructTest, UpdateTableTest)

@jackye1995 jackye1995 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good to me, just some improvement suggestions on tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It feels unnecessary to have a base and have different types of update tests, can we just combine everything into a single test class? Also I think we are missing corresponding tests for DELETE FROM

@fangbo fangbo changed the title feat: support update using MOR for spark3.5 feat: support update/delete using MOR for spark3.5 Sep 5, 2025

@jackye1995 jackye1995 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for the great work!! I will merge this one first, @fangbo could you also update the documentation accordingly?

@jackye1995
jackye1995 merged commit 05145c3 into lance-format:main Sep 5, 2025
5 checks passed
@fangbo

fangbo commented Sep 5, 2025

Copy link
Copy Markdown
Collaborator Author

thanks for the great work!! I will merge this one first, @fangbo could you also update the documentation accordingly?

Thanks for your review. I will update the documentation later.

@fangbo
fangbo deleted the spark-update-mor branch September 5, 2025 06:12
jiaoew1991 pushed a commit to jiaoew1991/lance-spark that referenced this pull request Dec 1, 2025
Related Issue: lance-format#41 and
lance-format#57

---------

Co-authored-by: fangbo.0511 <fangbo.0511@bytedance.com>
jiaoew1991 pushed a commit to jiaoew1991/lance-spark that referenced this pull request Feb 25, 2026
Related Issue: lance-format#41 and
lance-format#57

---------

Co-authored-by: fangbo.0511 <fangbo.0511@bytedance.com>
ivscheianu pushed a commit to ivscheianu/lance-spark that referenced this pull request Jul 20, 2026
Related Issue: lance-format#41 and
lance-format#57

---------

Co-authored-by: fangbo.0511 <fangbo.0511@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants