test(spark): tail-sweep coverage for low-coverage datasource classes - #19405
Draft
yihua wants to merge 1 commit into
Draft
test(spark): tail-sweep coverage for low-coverage datasource classes#19405yihua wants to merge 1 commit into
yihua wants to merge 1 commit into
Conversation
Add unit coverage for BaseHoodieCatalystExpressionUtils order-preserving transformation matching, org.apache.spark.sql.avro.AvroUtils schema matching and validation, and FileFormatUtilsForFileGroupReader filter lowering. Each assertion pins the exact translated output.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19405 +/- ##
============================================
+ Coverage 72.49% 74.85% +2.35%
+ Complexity 32888 32341 -547
============================================
Files 2574 2574
Lines 149010 142978 -6032
Branches 18749 17571 -1178
============================================
- Hits 108032 107032 -1000
+ Misses 32513 27885 -4628
+ Partials 8465 8061 -404
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Collaborator
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.
Describe the issue this Pull Request addresses
Part 2 of the Spark-datasource small-class coverage tail-sweep (sibling to #19164). Several small classes in the Spark datasource had low unit-test coverage, with branches reached only indirectly, if at all. This adds focused, behavior-pinning unit tests for the genuinely uncovered ones.
Summary and Changelog
Adds unit coverage for three low-coverage classes. Every assertion pins exact output, so a wrong result would fail the test.
org.apache.spark.sql.BaseHoodieCatalystExpressionUtils(0 missed lines, but many uncovered branches): newTestCatalystExpressionOrderPreservingdrivestryMatchAttributeOrderingPreservingTransformationacross the wholeOrderPreservingTransformationmatch. It asserts the exact sourceAttributeReferencerecovered for identity, arithmetic on either operand, unary math, string case, date add/sub, and order-preserving up-cast, and that non-order-preserving shapes (numeric-to-string cast, attribute-free arithmetic, a non-whitelistedSqrt) do not match.org.apache.spark.sql.avro.AvroUtils: newTestAvroUtilscoverssupportsDataType(atomic, struct, array, map, null supported;CalendarIntervaland its wrappers unsupported) and theAvroSchemaHelpermatching and validation paths previously exercised only through the Avro serializers: non-RECORD rejection, by-name vs positional field lookup, extra-Catalyst-field and extra-required-Avro-field validation (including theignoreNullableand nullable-Avro-field skips), and the ambiguous case-insensitive by-name match. Each error case pins the raisedIncompatibleSchemaExceptionmessage.org.apache.spark.sql.FileFormatUtilsForFileGroupReader: newTestFileFormatUtilsForFileGroupReadercoversapplyFiltersToPlan, pinning the Catalyst expression produced for each pushed-down data-sourceFilter(comparisons, null checks,In, string predicates,AlwaysTrue/AlwaysFalse, a nested and/or/not tree, and multi-filterAnd), and that an empty filter list returns the input plan unchanged.Candidates verified and left out:
VectorDistanceUtilsis already exhaustively covered with exact-value assertions byTestHoodieVectorSearchFunction, so no new test was added.HiveSyncProcedureandHoodieNestedSchemaPruningneed heavier end-to-end scaffolding (hive metastore, optimizer plan fixtures) and are deferred to a separate pass. No code was copied.Impact
Test-only. No production code changes, no public API change, and no behavior change.
Risk Level
none
Documentation Update
none
Contributor's checklist