Skip to content

Refactor BaseTableCRUDTest to split the testing table preparation into a new base class - #1153

Merged
tdas merged 1 commit into
unitycatalog:mainfrom
yili-db:refactor_base_table_crud_test
Nov 6, 2025
Merged

tdas merged 1 commit into
unitycatalog:mainfrom
yili-db:refactor_base_table_crud_test

Conversation

@yili-db

@yili-db yili-db commented Nov 4, 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

Refactor BaseTableCRUDTest to split the testing table preparation into a new base class BaseTableCRUDTestEnv.
This new base class BaseTableCRUDTestEnv will also be used by a new test for table commits.
The remaining part in BaseTableCRUDTest is the table crud tests.
Also createCommonResources() is called automatically for all tests based on BaseTableCRUDTestEnv.

@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch from 15883a4 to 5881ed5 Compare November 4, 2025 21:39
@@ -0,0 +1,97 @@
package io.unitycatalog.server.base.table;

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.

This file is split from BaseTableCRUDTest.java

@yili-db yili-db mentioned this pull request Nov 5, 2025
2 of 4 tasks
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch 2 times, most recently from 35e90fc to 5498d8d Compare November 5, 2025 04:13
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch 4 times, most recently from 6bd9253 to 313ed63 Compare November 5, 2025 21:19

@Test
public void testListTablesWithNoNextPageTokenShouldReturnNull() throws Exception {
createCommonResources();

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.

This function is now called inside setUp() for these tests.

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.

Sounds good to me.

@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch from 313ed63 to 9f2617f Compare November 5, 2025 21:23
super.setUp();
schemaOperations = createSchemaOperations(serverConfig);
tableOperations = createTableOperations(serverConfig);
createCommonResources();

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.

Do we need to clean those created common resources after each test ?

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.

Otherwise, I assume it will conflicts if we create those resources for the next test cases, right ?

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.

The entire catalog is deleted by BaseCRUDTest.cleanUp(), the lower level base class, despite that the catalog is created here.
It's a little weird but it's been like that. Maybe the reason is that not all tests based on BaseCRUDTest would need a catalog (or two).

Comment on lines +73 to +74
.typePrecision(10)
.typeScale(0)

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.

Why do we need the precision and scale for the integer type ? seems like those are definition for the float or double data types, right ?

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.

Yeah. I just copied this over so I didn't check. Removed.

.properties(TestUtils.PROPERTIES)
.comment(TestUtils.COMMENT)
.storageLocation(storageLocation)
.tableType(TableType.EXTERNAL)

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.

Since we don't support managed table currently, so we have to use the EXTERNAL right ?

@yili-db yili-db Nov 5, 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.

That's right. This will soon be changed to a parameter by the following PR.

@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch from 9f2617f to df5e26c Compare November 5, 2025 21:47
@yili-db
yili-db requested a review from openinx November 5, 2025 21:55
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch 4 times, most recently from a11023e to 0ae1405 Compare November 6, 2025 00:32
@yili-db yili-db closed this Nov 6, 2025
@yili-db yili-db reopened this Nov 6, 2025
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch from 0ae1405 to bdfea31 Compare November 6, 2025 19:13
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch 3 times, most recently from a74cf4d to 9e82c72 Compare November 6, 2025 19:25
tdas added a commit that referenced this pull request Nov 6, 2025
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1135/files) to
review incremental changes.
-
[**staging_table_service**](#1135)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1135/files)]
-
[refactor_base_table_crud_test](#1153)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1153/files/90c0f2a454c595eeb19df146f38a74e404de61b9..9e82c72fb64a8f5b50a11e0558b01ebb86f906a5)]
-
[staging_table_cli_test](#1136)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1136/files/9e82c72fb64a8f5b50a11e0558b01ebb86f906a5..b7cbb71bbf046d9926394052258e625b9921d303)]

---------
**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

    Support managed table creation

    - Update TableService for creation of managed tables
- Update API for CreateTable to make storage_location optional for
managed tables
- Enhance TemporaryTableCredentialsService with staging table support
    - Update KeyMapper to also check staging tables
    - Update repository classes to use new helper methods

<!-- Please state what you've changed and how it might affect the users.
-->
Related issue is:
#1143

---------

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Tathagata Das <[email protected]>

@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 on the incremental changes. will wait for the earlier prs in the stack to be merged first.

…o a new base class BaseTableCRUDTestEnv.

This new base class BaseTableCRUDTestEnv will also be used by a new test for table commits.

Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db force-pushed the refactor_base_table_crud_test branch from 9e82c72 to 8c05018 Compare November 6, 2025 19:53
@yili-db yili-db mentioned this pull request Nov 6, 2025
2 of 4 tasks
@tdas
tdas merged commit fc76ab5 into unitycatalog:main Nov 6, 2025
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/1135/files) to
review incremental changes.
-
[**staging_table_service**](unitycatalog#1135)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1135/files)]
-
[refactor_base_table_crud_test](unitycatalog#1153)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1153/files/90c0f2a454c595eeb19df146f38a74e404de61b9..9e82c72fb64a8f5b50a11e0558b01ebb86f906a5)]
-
[staging_table_cli_test](unitycatalog#1136)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1136/files/9e82c72fb64a8f5b50a11e0558b01ebb86f906a5..b7cbb71bbf046d9926394052258e625b9921d303)]

---------
**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

    Support managed table creation

    - Update TableService for creation of managed tables
- Update API for CreateTable to make storage_location optional for
managed tables
- Enhance TemporaryTableCredentialsService with staging table support
    - Update KeyMapper to also check staging tables
    - Update repository classes to use new helper methods

<!-- Please state what you've changed and how it might affect the users.
-->
Related issue is:
unitycatalog#1143

---------

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Tathagata Das <[email protected]>
yili-db added a commit to yili-db/unitycatalog that referenced this pull request Nov 19, 2025
…o a new base class (unitycatalog#1153)

Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/1153/files) to
review incremental changes.
-
[**refactor_base_table_crud_test**](unitycatalog#1153)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1153/files)]
-
[staging_table_cli_test](unitycatalog#1136)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/1136/files/8c0501897d14d08f1821d8c1cd93975305ebc3d8..95408a203472f015bd63cea1386e1c9134332373)]

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

- [X] 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**

Refactor BaseTableCRUDTest to split the testing table preparation into a
new base class BaseTableCRUDTestEnv.
This new base class BaseTableCRUDTestEnv will also be used by a new test
for table commits.
The remaining part in BaseTableCRUDTest is the table crud tests.
Also createCommonResources() is called automatically for all tests based
on BaseTableCRUDTestEnv.

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