Skip to content

Conversation

KodaiD
Copy link
Contributor

@KodaiD KodaiD commented Oct 16, 2025

Description

This PR adds alter column type tests for imported tables.

Imported tables can have columns with data types different from what ScalarDB regularly expects in the underlying storage. For example, in MySQL, not only INT but also INTEGER, MEDIUMINT, and SMALLINT are mapped to ScalarDB's INT. Therefore, we need to verify that the alter column type feature works for all possible data types that imported tables can have.

Related issues and/or PRs

Changes made

  • Add integration tests that verify the alter column type feature for imported tables.

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

N/A

@KodaiD KodaiD self-assigned this Oct 16, 2025
@KodaiD KodaiD force-pushed the add-alter-column-type-test-for-imported-table branch from 6d7111d to f5e715e Compare October 16, 2025 11:15
@KodaiD
Copy link
Contributor Author

KodaiD commented Oct 16, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR adds integration tests for altering column types on imported tables. The changes look good overall, with new tests covering type alteration to TEXT and widening conversions for various database backends. I've identified some opportunities for improvement:

  • There is duplicated code in the test setup logic that could be refactored into a helper method for better maintainability.
  • One of the new SQL Server tests has an inconsistency between its 'act' and 'assert' phases, which could lead to an incomplete verification.

My detailed comments are below.

@KodaiD KodaiD marked this pull request as ready for review October 16, 2025 23:57
@Copilot Copilot AI review requested due to automatic review settings October 16, 2025 23:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds integration tests for the alter column type feature when applied to imported database tables. The tests verify that column type alterations work correctly for tables that were imported from existing databases, covering both conversion to TEXT and widening conversions (INT to BIGINT, FLOAT to DOUBLE).

Key changes:

  • Added two new test methods in the base test class to verify alter column type operations on imported tables
  • Implemented helper methods to identify columns compatible with widening conversions for each supported database engine
  • Added database-specific test implementations to handle engine-specific limitations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
DistributedStorageAdminImportTableIntegrationTestBase.java Added base test methods for alter column type operations and abstract helper methods for retrieving compatible column names
JdbcEnv.java Added isSqlServer() helper method to detect SQL Server databases
JdbcAdminImportTestUtils.java Implemented column compatibility helper methods for each database engine (MySQL, PostgreSQL, Oracle, SQL Server, DB2)
JdbcAdminImportTableIntegrationTest.java Added concrete test implementations with database-specific handling for engines with limited type conversion support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@KodaiD KodaiD requested review from a team, Torch3333, brfrn169, feeblefakie and komamitsu and removed request for a team October 16, 2025 23:58
Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

Left a question. Other than that, LGTM! Thank you!

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@KodaiD KodaiD merged commit 4a4d176 into master Oct 20, 2025
114 of 116 checks passed
@KodaiD KodaiD deleted the add-alter-column-type-test-for-imported-table branch October 20, 2025 07:25
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.

5 participants