Skip to content

[FIX] PII detection missed in numeric columns - coerce values to string - #31921

Merged
TeddyCr merged 2 commits into
open-metadata:mainfrom
zhang-arvin:fix/pii-detection-numeric-columns
Sep 2, 2026
Merged

TeddyCr merged 2 commits into
open-metadata:mainfrom
zhang-arvin:fix/pii-detection-numeric-columns

Conversation

@zhang-arvin

@zhang-arvin zhang-arvin commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Fix #31847: Numeric column values (e.g., Oracle NUMBER type via oracledb) are captured in sample data but never evaluated by content-based pattern recognizers because convert_to_str() only handled int and float, missing decimal.Decimal and other numbers.Number subclasses.

Changes

  • preprocessing.py: Replace isinstance(value, (int, float, ...)) with isinstance(value, (numbers.Number, ...)) to handle all numeric types including decimal.Decimal, fractions.Fraction, etc.
  • test_preprocessing.py: Add test cases for decimal.Decimal values

Root cause

Oracle NUMBER type via oracledb driver returns decimal.Decimal, which is not a subclass of int or float. The old isinstance check silently skipped these values, making PII in numeric columns (national IDs, employee numbers, phone numbers) invisible to classification.

Related issues

Greptile Summary

The PR broadens PII preprocessing to stringify all numbers.Number values, allowing database-native numeric types such as decimal.Decimal to reach content-based recognizers.

  • Replaces the explicit int and float check with numbers.Number.
  • Adds unit coverage for integer-like and fractional decimal.Decimal values.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
ingestion/src/metadata/pii/algorithms/preprocessing.py Broadens numeric conversion to cover Decimal and other numeric implementations without changing the surrounding preprocessing flow.
ingestion/tests/unit/pii/algorithms/test_preprocessing.py Adds direct conversion assertions for representative Decimal values.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/pii-detecti..." | Re-trigger Greptile

Use numbers.Number instead of (int, float) to handle Decimal, Fraction
and other numeric types from database drivers (e.g., Oracle NUMBER via
oracledb returns decimal.Decimal). Previously these values were silently
skipped by convert_to_str(), making PII in numeric columns invisible to
content-based classification.

Closes open-metadata#31847
@zhang-arvin
zhang-arvin requested a review from a team as a code owner August 23, 2026 06:31
@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

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

@gitar-bot

gitar-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Expands value coercion in preprocessing to cover all numbers.Number subclasses, ensuring decimal.Decimal and other numeric types are evaluated by PII pattern recognizers. 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

@TeddyCr TeddyCr added the safe to test Add this label to run secure Github workflows on PRs label Aug 26, 2026
@TeddyCr
TeddyCr enabled auto-merge August 26, 2026 21:25
@IceS2
IceS2 requested a review from TeddyCr August 28, 2026 09:49
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 28, 2026
@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!

@TeddyCr TeddyCr added the safe to test Add this label to run secure Github workflows on PRs label Aug 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

@TeddyCr
TeddyCr added this pull request to the merge queue Aug 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-28T22:08:45Z)

Blocked the queue: py-tests-status

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

@TeddyCr
TeddyCr added this pull request to the merge queue Sep 1, 2026
Merged via the queue into open-metadata:main with commit 35cb82a Sep 2, 2026
139 of 150 checks passed
Rohit0301 pushed a commit that referenced this pull request Sep 3, 2026
…ng (#31921)

Use numbers.Number instead of (int, float) to handle Decimal, Fraction
and other numeric types from database drivers (e.g., Oracle NUMBER via
oracledb returns decimal.Decimal). Previously these values were silently
skipped by convert_to_str(), making PII in numeric columns invisible to
content-based classification.

Closes #31847

Co-authored-by: Teddy <[email protected]>
shrabantipaul-collate pushed a commit to PRADDZY/OpenMetadata that referenced this pull request Sep 3, 2026
…ng (open-metadata#31921)

Use numbers.Number instead of (int, float) to handle Decimal, Fraction
and other numeric types from database drivers (e.g., Oracle NUMBER via
oracledb returns decimal.Decimal). Previously these values were silently
skipped by convert_to_str(), making PII in numeric columns invisible to
content-based classification.

Closes open-metadata#31847

Co-authored-by: Teddy <[email protected]>

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.

PII: numeric column values are never matched by pattern recognizers

2 participants