Support max_sample_size via sampling_options with engine-aware bounds#2497
Support max_sample_size via sampling_options with engine-aware bounds#2497ganeshdogiparthi-db wants to merge 9 commits into
Conversation
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2497 +/- ##
==========================================
+ Coverage 69.41% 70.28% +0.86%
==========================================
Files 106 106
Lines 9578 9607 +29
Branches 1056 1060 +4
==========================================
+ Hits 6649 6752 +103
+ Misses 2731 2650 -81
- Partials 198 205 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
✅ 174/174 passed, 7 flaky, 2 skipped, 1h0m17s total Flaky tests:
Running from acceptance #5034 |
bishwajit-db
left a comment
There was a problem hiding this comment.
Thanks for the PR. The approach looks good overall: centralizing the bounds at normalization and switching the Databricks path to a temp view both make sense, and the test coverage is solid. A few comments inline, one of which is a real (if low-severity) mutation bug in the normalize service.
…port_for_max_sample_size_v3
…port_for_max_sample_size_v3
|
Thanks for the update. Overall this looks solid, and docs/tests coverage is strong. I have one concern: Potential issue: Databricks temp-view cleanup in sampling pathIn I checked the reconcile flow and don’t see a corresponding drop/cleanup for those views after query execution. Because the view name is unique per call, this can accumulate temp views during longer runs (many tables and multiple sampling passes), which may increase Spark session metadata/memory overhead. Suggestion: track the created view name and explicitly drop it after the read step (or wrap create/query/drop in a scoped helper). |
m-abulazm
left a comment
There was a problem hiding this comment.
Unblocking although the UX still needs improvement
…port_for_max_sample_size_v3 # Conflicts: # tests/integration/reconcile/query_builder/test_execute.py
A user setting sampling_options: { specifications: { value: 500 } } on an aggregates table gets 500 for row-level reconcile but 50 for aggregates-reconcile. Either wire get_max_sample_size() here or document aggregates as a known limitation.
Happy to approve once aggregate sampling is either wired or explicitly documented. |
|
Changes
What does this PR do?
Adds a
sampling_optionsblock to the reconcile table config so users can control how many sample rows are captured per result set (mismatch, missing-in-source,missing-in-target) instead of the fixed 50. Previously large sample sizes on Databricks blew up the UNION-based sampling query against Spark Connect; the Databricks path now uses
a temp view so it scales.
Relevant implementation details
SamplingSpecificationsnow defaults tocount/50and validates the value (coerces to int, rejects bools/non-numeric, keepsfractiondisabled).Table.get_max_sample_size()exposes the configured value.NormalizeReconConfigService(engine-aware), not in the samplers:[1, 50_000].400, larger values capped at 400 with a warning.value <= 0falls back to 50.SamplingQueryBuilderregisters the recon keys as a temp view for the Databricks engine (SELECT * FROM recon_keys_<uuid>) so the generated SQL stays small regardless ofsample size; other dialects keep the inline-UNION derived table.
[50, 400]clamp was removed from the samplers.Caveats/things to watch out for when reviewing:
fractionsampling type stays disabled and raises a config error.Linked issues
Resolves #2559
Functionality
databricks labs lakebridge ...sampling_optionson the reconcile Table configTests
column mapping, drop columns and schema validation