fix: make binningUdf/maxBins optional in hasNumberOfDistinctValues/hasHistogramValues (#81)#274
Open
nikolauspschuetz wants to merge 1 commit into
Conversation
hasNumberOfDistinctValues and hasHistogramValues forced callers to pass binningUdf and maxBins, although Deequ's Scala API marks both as optional with defaults (binningUdf=None, maxBins=Histogram.MaximumAllowedDetailBins). Default to the Scala-side defaults via the apply$default$N accessors when the args are omitted, mirroring the existing satisfies() pattern. Existing positional callers remain backward compatible. Fixes awslabs#81
Author
|
Ready for review. Makes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
hasNumberOfDistinctValuesandhasHistogramValuesforce the caller to passbinningUdfandmaxBins, but Deequ's Scala API defines both with defaults. So a natural call:raises
TypeError: ... missing 2 required positional arguments: 'binningUdf' and 'maxBins'. Reported in #81.Fix
Make
binningUdfandmaxBinsoptional (=None). When omitted, the wrapper substitutes Deequ's own defaults pulled from the JVM via the...$default$Naccessors — the same pattern PyDeequ already uses insatisfies():binningUdfdefault → ScalaOption.emptymaxBinsdefault →Histogram.MaximumAllowedDetailBinsPulling defaults from the live jar (rather than hardcoding) keeps them correct across Deequ versions. Fully backward-compatible: existing positional calls are unchanged.
Tests
Added to
tests/test_checks.py:test_hasNumberOfDistinctValues_without_binning_argstest_hasHistogramValues_without_binning_argsThe pre-existing positional-arg tests are left untouched to prove backward compatibility. Validated against real Spark 3.5 / Deequ 2.0.8 (8 passed). CI runs the full pyspark matrix.
Closes #81