Skip to content

[2.0] Fixes #37877: [Oracle] Fix percentage sampling reading all rows or none - #37940

Merged
mohittilala merged 1 commit into
2.0from
backport/2.0/pr-37881
Nov 17, 2026
Merged

mohittilala merged 1 commit into
2.0from
backport/2.0/pr-37881

Conversation

@gh-bot-collate

@gh-bot-collate gh-bot-collate Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Automated backport of #37881 to 2.0.

Source PR #37881
Author @mohittilala
Merge commit 13f551f431bea9cdcf88659347294938b4b55904
Method Conflicts resolved by Claude — worth a read of the diff.

Resolution notes

Backport notes: #37881 → 2.0

Conflict

ingestion/tests/integration/test_oracle_sampling.py conflicted as "deleted by us":
this file does not exist on 2.0 at all. It was originally added on main by
PR #37074 (Fixes 7370: Compile Oracle table-diff sampling with supported SQL),
which reached 2.1 via a release merge but was never backported to 2.0. PR #37881
then added a second test to that same file on main, which is what produced the
conflict here.

Resolution

Recreated the file on 2.0 containing only the test added by #37881
(test_percentage_sample_reads_part_of_the_table_in_every_metric_query), plus the
oracle_sampling_connection fixture it depends on. The pre-existing test from #37074
(test_oracle_sampling_matches_utf8_selected_ids, and its now-unused imports:
hashlib, TableParameter, build_sample_where_clause, DatabaseServiceType,
SALT/THRESHOLD) was intentionally not reintroduced — it belongs to a separate,
unrelated PR that was never backported to 2.0 and is out of scope for this change.
If that test is wanted on 2.0, it should be backported separately via #37074.

The module docstring was adjusted from "Sampling against physical scalar columns in a
designated disposable Oracle database" (which described the removed test) to
"Sampling against a designated disposable Oracle database" to match the trimmed file's
actual content.

All other files in this cherry-pick applied cleanly with no conflicts:

  • ingestion/src/metadata/ingestion/source/database/oracle/service_spec.py (registers OracleSampler)
  • ingestion/src/metadata/sampler/sqlalchemy/oracle/sampler.py (new OracleSampler)
  • ingestion/tests/unit/observability/profiler/sqlalchemy/oracle/test_oracle_sampling.py (new unit test)

What a reviewer should check


Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #37881 is asked to look.

resolver run

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Registers OracleSampler and adds NO_MERGE to keep Oracle from merging the query that draws each row’s random value.

  • Oracle percentage samples choose rows separately before filtering them.

Reviews (1) · Last reviewed commit: "Add Oracle sampler that keeps percentage..." · Reviewed by Greptile

- The percentage sample filter references no column, so with COUNT(DISTINCT) in the metric query Oracle evaluated it once per execution and each metric read every row or none
- OracleSampler draws the random value in a NO_MERGE query block and is registered in the Oracle service spec
- Add a compile test and an Oracle integration test that samples 50% eight times

(cherry picked from commit 13f551f)
@gh-bot-collate
gh-bot-collate Bot requested a review from a team as a code owner November 17, 2026 05:59
@gh-bot-collate
gh-bot-collate Bot requested review from stout-yeoman and removed request for a team November 17, 2026 05:59
@gh-bot-collate gh-bot-collate Bot added the safe to test Add this label to run secure Github workflows on PRs label Nov 17, 2026
@gh-bot-collate

Copy link
Copy Markdown
Author

🤖 This backport will not merge itself: 2.0 has no required status checks, so there is nothing for auto-merge to wait on. Merge it by hand once CI is green.

@mohittilala
mohittilala merged commit 2ac8cb5 into 2.0 Nov 17, 2026
67 of 72 checks passed
@mohittilala
mohittilala deleted the backport/2.0/pr-37881 branch November 17, 2026 12:58
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.

2 participants