Skip to content

Fixes #18576: keep Oracle CHAR length semantics in the reflected column type - #32306

Merged
Khairajani merged 7 commits into
mainfrom
fix/18576-oracle-char-semantics
Sep 5, 2026
Merged

Khairajani merged 7 commits into
mainfrom
fix/18576-oracle-char-semantics

Conversation

@Khairajani

@Khairajani Khairajani commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #18576

VARCHAR2(10 CHAR) and VARCHAR2(10 BYTE) were both surfaced as VARCHAR2(10), so the two are indistinguishable in OpenMetadata even though the length semantics differ — which matters on a multi-byte character set.

The reason is that the Oracle column reflection never read ALL_TAB_COLS.CHAR_USED, the only place the declared semantics survive: CHAR_LENGTH holds the same declared number under both. ORACLE_GET_COLUMNS now selects CHAR_USED, and _get_col_type appends the qualifier when it is 'C'.

Declared dataTypeDisplay before after
VARCHAR2(10 CHAR) VARCHAR2(10) VARCHAR2(10 CHAR)
VARCHAR2(10 BYTE) VARCHAR2(10) VARCHAR2(10)
CHAR(5 CHAR) CHAR(5) CHAR(5 CHAR)
NVARCHAR2(20) NVARCHAR2(20) NVARCHAR2(20)

Two things worth a reviewer's attention:

  • The qualifier is limited to VARCHAR2 and CHAR. NVARCHAR2/NCHAR also report CHAR_USED = 'C' because they are always character based, but Oracle never renders them with the qualifier, so adding it there would be wrong.
  • BYTE is rendered as a bare VARCHAR2(n), not VARCHAR2(n BYTE) — this matches the expected behaviour stated in the issue and keeps the display stable for everyone not using character semantics.
  • CHAR_USED is selected ahead of the identity columns, so get_columns reads default_on_null and identity_options one position further along (row[9]/[10] → row[10]/[11]). This is the riskiest line in the diff; the tests below cover it on both the 12c+ path (real IDENTITY_OPTIONS string) and the pre-12c path (where identity_cols is a pair of NULL literals).

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • An Oracle column declared VARCHAR2(n CHAR) is displayed as VARCHAR2(n CHAR)
  • An Oracle column declared VARCHAR2(n BYTE) / VARCHAR2(n) is displayed as VARCHAR2(n)
  • NVARCHAR2 / NCHAR columns are unchanged despite reporting character semantics
  • Identity and non-string columns still reflect correctly after the select-list change, on both Oracle 11g and 19c

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added: ingestion/tests/unit/topology/database/test_oracle_char_semantics.py
  • Verified the new tests fail against the unpatched source and pass with the fix; the existing Oracle suites (test_oracle.py, test_oracle_constraint_reflection.py, tests/unit/source/database/oracle/) stay green — 45 passed.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable — the change is covered by unit tests against the reflection query; an integration test would need a live Oracle instance with both column semantics.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Not run against a live Oracle instance. The behaviour is pinned by unit tests that drive the real OracleDialect.get_columns over rows shaped exactly as ORACLE_GET_COLUMNS returns them.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For UI changes: not applicable.
  • I have added tests and listed them above.
  • I have added a test that covers the exact scenario we are fixing, with the issue number referenced in the test for future reference.

Greptile Summary

This PR preserves Oracle character-length semantics when reflecting VARCHAR2 and CHAR columns while retaining the existing display for byte semantics and national character types.

  • Adds CHAR_USED to the Oracle catalog query.
  • Uses the flag to render character-semantics type displays.
  • Shifts identity-field decoding to match the updated result shape.
  • Adds focused coverage for Oracle 11g and 19c reflection paths.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The catalog query and positional decoder remain aligned across Oracle version branches, and the new display format is confined to the intended character-semantics types with focused regression coverage.

Important Files Changed

Filename Overview
ingestion/src/metadata/ingestion/source/database/oracle/queries.py Adds CHAR_USED to the reflected catalog row before the two consistently generated identity fields.
ingestion/src/metadata/ingestion/source/database/oracle/utils.py Preserves character semantics in displayed Oracle types and correctly adjusts positional decoding for the expanded query result.
ingestion/tests/unit/topology/database/test_oracle_char_semantics.py Covers CHAR and BYTE semantics, unaffected national character and non-string types, identity decoding, and pre-12c query shape.

Reviews (1): Last reviewed commit: "Fixes #18576: keep Oracle CHAR length se..." | Re-trigger Greptile

…mn type

VARCHAR2(10 CHAR) and VARCHAR2(10 BYTE) were both surfaced as VARCHAR2(10).
The column reflection never read ALL_TAB_COLS.CHAR_USED, which is the only
place the declared semantics survive -- CHAR_LENGTH holds the declared number
under both. Select CHAR_USED and append the CHAR qualifier when it is 'C'.

The qualifier is limited to VARCHAR2 and CHAR. NVARCHAR2 and NCHAR also report
CHAR_USED = 'C' because they are always character based, but Oracle never
renders them with it.

CHAR_USED is selected ahead of the identity columns, so get_columns reads
default_on_null and identity_options one position further along.
@Khairajani
Khairajani requested a review from a team as a code owner August 31, 2026 14:36
@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit bbc76c7df1979bae8edece7596114574b55a1d90 in Playwright run 33903813762, attempt 1.

✅ 109 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 43m 12s

⏱️ Max setup 5m 8s · max shard execution 12m 19s · max shard-job elapsed before upload 17m 22s · reporting 4s

🌐 234.83 requests/attempt · 1.77 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 234.83 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.77 per UI scenario (213 boots / 120 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 24 0 0 0 0 0
✅ Shard ingestion-02 39 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Aug 31, 2026
@Khairajani
Khairajani added this pull request to the merge queue Sep 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-01T12:15:30Z)

Blocked the queue: py-tests-status

  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-3)
  • py-tests — python / Integration Tests (shard-3), python / Unit Tests & Static Checks (3.10)

@Khairajani
Khairajani enabled auto-merge September 2, 2026 06:17
@Khairajani
Khairajani added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-02T13:57:15Z)

Blocked the queue: py-tests-status

  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-2)

@Khairajani
Khairajani added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-03T02:46:56Z)

Blocked the queue: py-tests-status

  • py-tests — python / Integration Tests (shard-2), python / Integration Tests (shard-2), python / Integration Tests (shard-2)
  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-2), python / Integration Tests (shard-2), python / Integration Tests (shard-2)

@Khairajani
Khairajani added this pull request to the merge queue Sep 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-04T01:39:08Z)

Blocked the queue: py-tests-status

  • py-tests — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-3)

@gitar-bot

gitar-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Preserves Oracle character-length semantics in reflected column types by reading CHAR_USED from the catalog and appending the qualifier to VARCHAR2 and CHAR declarations. Identity and non-string columns remain correct after the select-list expansion, with comprehensive unit test coverage for both Oracle 11g and 19c reflection paths. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Khairajani
Khairajani added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 3245ca2 Sep 5, 2026
105 checks passed
@Khairajani
Khairajani deleted the fix/18576-oracle-char-semantics branch September 5, 2026 07:29
Khairajani added a commit that referenced this pull request Sep 5, 2026
…mn type (#32306) (#32628)

* Fixes #18576: keep Oracle CHAR length semantics in the reflected column type

VARCHAR2(10 CHAR) and VARCHAR2(10 BYTE) were both surfaced as VARCHAR2(10).
The column reflection never read ALL_TAB_COLS.CHAR_USED, which is the only
place the declared semantics survive -- CHAR_LENGTH holds the declared number
under both. Select CHAR_USED and append the CHAR qualifier when it is 'C'.

The qualifier is limited to VARCHAR2 and CHAR. NVARCHAR2 and NCHAR also report
CHAR_USED = 'C' because they are always character based, but Oracle never
renders them with it.

CHAR_USED is selected ahead of the identity columns, so get_columns reads
default_on_null and identity_options one position further along.

* chore: empty commit to retrigger CI

(cherry picked from commit 3245ca2)

This branch was previously deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot differentiate between VARCHAR2($n CHAR) and VARCHAR2($n) for Oracle column types

2 participants