Skip to content

Conversation

@Torch3333
Copy link
Contributor

@Torch3333 Torch3333 commented Dec 3, 2025

Description

The Oracle NUMBER(1) data type is used to map ScalarDB BOOLEAN. Though when importing a table with a column with this data type, the type will automatically be mapped to a ScalarDB BIGINT.
This PR adds the possibility to override the data type mapping to ScalarDB BOOLEAN.

Related issues and/or PRs

N/A

Changes made

  • When importing a table on Oracle, allow overriding the NUMBER(1) data type to BOOLEAN.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • 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

On Oracle, when importing a table with a column using the NUMBER(1) data type, which is usually used for BOOLEAN data, that column can now be mapped to ScalarDB BOOLEAN using ScalarDB Schema Loader override-columns-type setting.

@Torch3333 Torch3333 self-assigned this Dec 3, 2025
@Torch3333
Copy link
Contributor Author

/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 pull request correctly implements the feature to allow importing Oracle's NUMBER(1) data type as a BOOLEAN when an override is specified. The changes are well-contained, and both integration and unit tests have been updated to cover the new functionality and ensure existing behavior is not broken. I have one minor suggestion to improve maintainability by using a constant for a magic number.

@Torch3333 Torch3333 changed the title For Oracle, allow importing a NUMBER(1) data type with BOOLEAN type override For Oracle, allow importing a table with NUMBER(1) data type to a ScalarDB BOOLEAN Dec 3, 2025
@Torch3333 Torch3333 marked this pull request as ready for review December 3, 2025 06:03
@Torch3333 Torch3333 requested review from a team, brfrn169, Copilot, feeblefakie and komamitsu and removed request for a team December 3, 2025 06:03
Copilot finished reviewing on behalf of Torch3333 December 3, 2025 06:05
Copy link
Contributor

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 enables Oracle NUMBER(1) columns to be mapped to ScalarDB BOOLEAN data type during table import operations. Previously, NUMBER(1) was automatically mapped to BIGINT, which was inconsistent with Oracle's convention of using NUMBER(1) to represent boolean values. The change allows users to override this mapping using the override-columns-type setting in ScalarDB Schema Loader.

  • Added conditional logic in RdbEngineOracle to map NUMBER(1) to BOOLEAN when explicitly overridden
  • Enhanced test coverage to verify both default behavior (NUMBER(1) → BIGINT) and override behavior (NUMBER(1) → BOOLEAN)
  • Extended integration tests to validate the end-to-end override functionality

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineOracle.java Implements the core logic to support NUMBER(1) to BOOLEAN override in the getDataTypeForScalarDbInternal method
core/src/test/java/com/scalar/db/storage/jdbc/RdbEngineTest.java Adds unit test cases for both the override behavior and default BIGINT mapping of Oracle NUMBER(1)
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTestUtils.java Extends integration test with a new column (col22) to validate NUMBER(1) to BOOLEAN override functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Torch3333 Torch3333 requested a review from brfrn169 December 4, 2025 00:59
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.

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!

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! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants