yihua opened a new pull request, #19405: URL: https://github.com/apache/hudi/pull/19405
### 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): new `TestCatalystExpressionOrderPreserving` drives `tryMatchAttributeOrderingPreservingTransformation` across the whole `OrderPreservingTransformation` match. It asserts the exact source `AttributeReference` recovered 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-whitelisted `Sqrt`) do not match. - `org.apache.spark.sql.avro.AvroUtils`: new `TestAvroUtils` covers `supportsDataType` (atomic, struct, array, map, null supported; `CalendarInterval` and its wrappers unsupported) and the `AvroSchemaHelper` matching 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 the `ignoreNullable` and nullable-Avro-field skips), and the ambiguous case-insensitive by-name match. Each error case pins the raised `IncompatibleSchemaException` message. - `org.apache.spark.sql.FileFormatUtilsForFileGroupReader`: new `TestFileFormatUtilsForFileGroupReader` covers `applyFiltersToPlan`, pinning the Catalyst expression produced for each pushed-down data-source `Filter` (comparisons, null checks, `In`, string predicates, `AlwaysTrue` / `AlwaysFalse`, a nested and/or/not tree, and multi-filter `And`), and that an empty filter list returns the input plan unchanged. Candidates verified and left out: `VectorDistanceUtils` is already exhaustively covered with exact-value assertions by `TestHoodieVectorSearchFunction`, so no new test was added. `HiveSyncProcedure` and `HoodieNestedSchemaPruning` need 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 - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
