Repository navigation
Fixes #18576: keep Oracle CHAR length semantics in the reflected column type - #32306
Conversation
…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.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
✅ Playwright Results — workflow succeededValidated commit ✅ 109 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking 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:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
Code Review ✅ ApprovedPreserves Oracle character-length semantics in reflected column types by reading OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
…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)



Describe your changes:
Fixes #18576
VARCHAR2(10 CHAR)andVARCHAR2(10 BYTE)were both surfaced asVARCHAR2(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_LENGTHholds the same declared number under both.ORACLE_GET_COLUMNSnow selectsCHAR_USED, and_get_col_typeappends the qualifier when it is'C'.dataTypeDisplaybeforeVARCHAR2(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:
VARCHAR2andCHAR.NVARCHAR2/NCHARalso reportCHAR_USED = 'C'because they are always character based, but Oracle never renders them with the qualifier, so adding it there would be wrong.BYTEis rendered as a bareVARCHAR2(n), notVARCHAR2(n BYTE)— this matches the expected behaviour stated in the issue and keeps the display stable for everyone not using character semantics.CHAR_USEDis selected ahead of the identity columns, soget_columnsreadsdefault_on_nullandidentity_optionsone 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 (realIDENTITY_OPTIONSstring) and the pre-12c path (whereidentity_colsis a pair ofNULLliterals).Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
VARCHAR2(n CHAR)is displayed asVARCHAR2(n CHAR)VARCHAR2(n BYTE)/VARCHAR2(n)is displayed asVARCHAR2(n)NVARCHAR2/NCHARcolumns are unchanged despite reporting character semanticsUnit tests
ingestion/tests/unit/topology/database/test_oracle_char_semantics.pytest_oracle.py,test_oracle_constraint_reflection.py,tests/unit/source/database/oracle/) stay green — 45 passed.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Not run against a live Oracle instance. The behaviour is pinned by unit tests that drive the real
OracleDialect.get_columnsover rows shaped exactly asORACLE_GET_COLUMNSreturns them.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
This PR preserves Oracle character-length semantics when reflecting
VARCHAR2andCHARcolumns while retaining the existing display for byte semantics and national character types.CHAR_USEDto the Oracle catalog query.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
CHAR_USEDto the reflected catalog row before the two consistently generated identity fields.Reviews (1): Last reviewed commit: "Fixes #18576: keep Oracle CHAR length se..." | Re-trigger Greptile