Skip to content

Add basic support of Delta commits for managed tables - #1166

Merged
tdas merged 5 commits into
unitycatalog:mainfrom
yili-db:stack/commit_basic
Nov 12, 2025
Merged

tdas merged 5 commits into
unitycatalog:mainfrom
yili-db:stack/commit_basic

Conversation

@yili-db

@yili-db yili-db commented Nov 6, 2025 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

This commit adds API support for committing Delta table versions to Unity Catalog
with coordinated commit semantics. When multiple clients attempt to commit the
same version simultaneously, UC guarantees that only one will succeed.

Key features:

  • POST endpoint at /delta/preview/commits for committing new table versions
  • Strict sequential version validation (version N+1 must follow version N)
  • Onboarding flow for tables with no existing commits
  • Comprehensive validation of commit metadata and table properties
  • Only managed delta tables are supported

Known limitations (documented in code):

  • Table metadata updates not yet implemented
  • Backfill of commits not yet supported
  • Cleanup of commits when deleting tables not yet implemented
  • RPC support for reading commit lists not yet implemented

Related issue
#1143

@yili-db
yili-db force-pushed the stack/commit_basic branch 3 times, most recently from 6864c9d to 2b51c0f Compare November 6, 2025 19:25
@yili-db yili-db changed the title Add coordinated commits API to the spec <WIP><Do not review> Nov 6, 2025
@yili-db
yili-db force-pushed the stack/commit_basic branch from 2b51c0f to 693c051 Compare November 6, 2025 19:53
@yili-db yili-db mentioned this pull request Nov 6, 2025
2 of 4 tasks
@yili-db
yili-db force-pushed the stack/commit_basic branch from 693c051 to 2ec21c0 Compare November 7, 2025 09:15
tdas pushed a commit that referenced this pull request Nov 7, 2025
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1127/files) to
review incremental changes.
-
[**commit_api**](#1127)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1127/files)]
-
[stack/commit_basic](#1166)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files/725c6b686f9f169fb10d7109dfa2c5ea2cd58a4e..2ec21c04831867e54feef742774af6c7b034dea1)]
-
[stack/commit_backfill_delete_meta](#1169)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/6d0a2246ce9ded3408587e35355ad46deb22dd2d..711f75644a2ae2559277413d36c8e7118a9bd3ca)]
-
[stack/commit_get](#1170)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/333883036048eb3c5fc5defd6ad193849b2286a4..3e5b8dfe047577223b7e9decac67725e5f4d6c76)]

---------
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Add coordinated commits API to the spec

Related issue is:
#1143

---------

Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db force-pushed the stack/commit_basic branch from 2ec21c0 to b9f6726 Compare November 7, 2025 18:07
@yili-db yili-db changed the title <WIP><Do not review> Add basic support for coordinated commits for managed tables Nov 7, 2025
@yili-db
yili-db marked this pull request as ready for review November 7, 2025 18:51
@yili-db
yili-db force-pushed the stack/commit_basic branch 2 times, most recently from e583d0f to 6b0e4da Compare November 7, 2025 18:54
}

protected TableInfo createAndVerifyTable() throws IOException, ApiException {
protected TableInfo createAndVerifyExternalTable() throws IOException, ApiException {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here is a little cross over from the staging table CLI&test PR. But it's essential to make the test pass. This change should be gone if the PR is merged first.

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.

the staging table PR is merged. can you update this?

}

public TableInfo createTable(CreateTable createTableRequest) throws ApiException {
if (createTableRequest.getTableType() == TableType.MANAGED) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here is a little cross over from the staging table CLI&test PR. But it's essential to make the test pass. This change should be gone if the PR is merged first.

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.

please update the PR since that one is merged

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class SdkCoordinatedCommitsCRUDTest extends BaseTableCRUDTestEnv {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Only SDK test. No CLI test. Because commits will not be part of CLI operation.

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.

call it DeltaCommits

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Renamed to SdkDeltaCommitsCRUDTest

@yili-db
yili-db force-pushed the stack/commit_basic branch 2 times, most recently from 56cc175 to d7f2459 Compare November 7, 2025 19:22
import org.hibernate.query.Query;

/** Repository for managing coordinated commits for managed Delta tables in Unity Catalog. */
public class CommitRepository {

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 you name these specifically with Delta?
these are related to Delta tables only.. lets make that explicit in all these new classes.

@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CommitDAO {

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.

DeltaCommitDAO

* REST API service for coordinated commits to Delta tables in Unity Catalog.
*/
@ExceptionHandler(GlobalExceptionHandler.class)
public class CoordinatedCommitsService extends AuthorizedService {

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.

DeltaCommitsService

@@ -0,0 +1,213 @@
package io.unitycatalog.server.sdk.coordinatedcommits;

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 put this in the package deltacommits
i am trying to delta explicitly to make it clear that its for delta.

@Override
public void setUp() {
super.setUp();
coordinatedCommitsApi = new CoordinatedCommitsApi(TestUtils.createApiClient(serverConfig));

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.

is this CoordinatedCommitsApi what is generated from the REST spec? if so, can the generated class name be changed to DeltaCommits (by changing the write annotation in the spec) while making sure the REST protocol is not changed?

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.

does not have to be in this PR.. but please make a follow up PR for this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes it's from the rest spec. Will do a follow up PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Following up in #1199

Comment on lines +123 to +124
assertThat(ex.getCode()).isEqualTo(ErrorCode.ALREADY_EXISTS.getHttpStatus().code());
assertThat(ex.getMessage()).contains("Commit version already accepted.");

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.

this pattern seems to repeat a lot. cant we make this less verbose by defining utils that can be used across test suites?

This commit adds API support for committing Delta table versions to Unity Catalog
with coordinated commit semantics. When multiple clients attempt to commit the
same version simultaneously, UC guarantees that only one will succeed.

Key features:
- POST endpoint at /delta/preview/commits for committing new table versions
- Strict sequential version validation (version N+1 must follow version N)
- Onboarding flow for tables with no existing commits
- Comprehensive validation of commit metadata and table properties
- Only managed delta tables are supported

Known limitations (documented in code):
- Table metadata updates not yet implemented
- Backfill of commits not yet supported
- Cleanup of commits when deleting tables not yet implemented
- RPC support for reading commit lists not yet implemented

Signed-off-by: Yi Li <[email protected]>
- renamed to Delta*
- added util function assertApiException

Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db requested a review from tdas November 12, 2025 08:21
@yili-db yili-db mentioned this pull request Nov 12, 2025
2 of 4 tasks

@Entity
@Table(
name = "uc_commits",

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.

shouldnt the table name have delta as well then!

@yili-db yili-db Nov 12, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@tdas tdas 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.

LGTM. just a few more comments.. but can be resolved in the follow up PR as well. i am inclined to merge this to unblock your follow up PRs. but please dont forget to address these comments in follow up PR.

@yili-db

yili-db commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator Author

@tdas Thank you! Please go ahead with merging. I'll address the remaining comments in following PRs.

@yili-db yili-db changed the title Add basic support for coordinated commits for managed tables Add basic support of Delta commits for managed tables Nov 12, 2025
handleOnboardingCommit(session, tableId, tableInfoDAO, commit);
} else {
DeltaCommitDAO firstCommit = firstAndLastCommits.get(0);
DeltaCommitDAO lastCommit = firstAndLastCommits.get(1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if there is only one record in the TableInfoDao, then the firstAndLastCommits should only have one record, which will produce a out of bound error , right ?

@yili-db yili-db Nov 12, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No. This query always returns two records (or empty list). If there's only one record, it returns that same record twice.

@yili-db yili-db Nov 12, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@tdas
tdas merged commit 82d4b4e into unitycatalog:main Nov 12, 2025
yili-db added a commit to yili-db/unitycatalog that referenced this pull request Nov 19, 2025
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1127/files) to
review incremental changes.
-
[**commit_api**](unitycatalog#1127)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1127/files)]
-
[stack/commit_basic](unitycatalog#1166)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files/725c6b686f9f169fb10d7109dfa2c5ea2cd58a4e..2ec21c04831867e54feef742774af6c7b034dea1)]
-
[stack/commit_backfill_delete_meta](unitycatalog#1169)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/6d0a2246ce9ded3408587e35355ad46deb22dd2d..711f75644a2ae2559277413d36c8e7118a9bd3ca)]
-
[stack/commit_get](unitycatalog#1170)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/333883036048eb3c5fc5defd6ad193849b2286a4..3e5b8dfe047577223b7e9decac67725e5f4d6c76)]

---------
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Add coordinated commits API to the spec

Related issue is:
unitycatalog#1143

---------

Signed-off-by: Yi Li <[email protected]>
yili-db added a commit to yili-db/unitycatalog that referenced this pull request Nov 19, 2025
)

Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1166/files) to
review incremental changes.
-
[**stack/commit_basic**](unitycatalog#1166)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files)]
-
[stack/commit_api_2](unitycatalog#1199)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1199/files/8c6992aaad6b981ef38a4fb468ef700f083ad49a..d0d4f606101bc705a6a79514a2b4ba31b2b19b19)]
-
[stack/commit_backfill_delete_meta](unitycatalog#1169)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/d0d4f606101bc705a6a79514a2b4ba31b2b19b19..93dc85893930d1594b3a974cc48228c767f826ab)]
-
[stack/commit_get](unitycatalog#1170)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/93dc85893930d1594b3a974cc48228c767f826ab..0e7306a1c14f5476eeef78953b948fd2f7ba0453)]
-
[stack/commit_access_test](unitycatalog#1178)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1178/files/0e7306a1c14f5476eeef78953b948fd2f7ba0453..6042111d1b885fc5a9cf687b670c98b95ade14d7)]
-
[stack/ccv2_spark](unitycatalog#1186)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1186/files/6042111d1b885fc5a9cf687b670c98b95ade14d7..cc09752cb91d6c9e6bf474ebc05c82f7a0da95cc)]

---------
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [ ] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

This commit adds API support for committing Delta table versions to
Unity Catalog
with coordinated commit semantics. When multiple clients attempt to
commit the
same version simultaneously, UC guarantees that only one will succeed.

Key features:
- POST endpoint at /delta/preview/commits for committing new table
versions
- Strict sequential version validation (version N+1 must follow version
N)
- Onboarding flow for tables with no existing commits
- Comprehensive validation of commit metadata and table properties
- Only managed delta tables are supported

Known limitations (documented in code):
- Table metadata updates not yet implemented
- Backfill of commits not yet supported
- Cleanup of commits when deleting tables not yet implemented
- RPC support for reading commit lists not yet implemented

**Related issue**
unitycatalog#1143

---------

Signed-off-by: Yi Li <[email protected]>
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.

3 participants