rangareddy opened a new pull request, #19859: URL: https://github.com/apache/hudi/pull/19859
### Describe the issue this Pull Request addresses Closes #17410 (https://issues.apache.org/jira/browse/HUDI-9194). The ticket asks whether `HoodieTableMetadataUtil#getColumnsToIndexWithoutRequiredMetaFields` needs a test case. Reading `TestHoodieTableMetadataUtil#testGetColumnsToIndex`, most of it is already covered through the public `getColumnsToIndex` wrapper: the explicit column list, meta columns appearing inside that list, unsupported column types, nested fields, the max-columns cap, and meta fields disabled. One branch is not reachable from any existing case. Every case there supplies a table schema, so the path taken when the schema is **absent** is never exercised: ```java if (tableSchemaLazyOpt.get().isPresent()) { ... } else { // initialize col stats index config with empty list of cols return Collections.emptyMap(); } ``` and, on the explicit-list side of the same method, the guard that fires when there is no schema to resolve names against: ```java ValidationUtils.checkArgument(tableSchemaLazyOpt.get().isPresent(), "Table schema not found for the table while computing col stats"); ``` ### Summary and Changelog - `TestHoodieTableMetadataUtil`: new `testGetColumnsToIndexWhenTableSchemaIsAbsent`, covering the schema-absent branch in the three ways it behaves: - **No explicit column list**: the inner call returns nothing, so the caller is left with just the always-indexed meta columns. Col stats initialises rather than failing. - **An explicit column list**: `IllegalArgumentException` naming the missing schema. The configured names cannot be resolved to field schemas without one, and quietly indexing nothing would look like the config had been honoured. - **The same list while the table is initialising**: the configured names are recorded without their schemas, so col stats can be enabled before the first commit has produced a schema. No code was copied. ### Impact Test-only. No production code is touched, and no existing test is modified. Worth noting for a reader: writing this corrected two assumptions of mine that the run disproved. The schema-absent, no-list case does **not** return an empty map to the caller, because the wrapper still adds `META_COLS_TO_ALWAYS_INDEX`; and the initialising case returns five entries, not two, for the same reason. The test asserts what the code does. ### Risk Level none Verified on Spark 3.5 / Scala 2.12: - `mvn test -pl hudi-hadoop-common -Dtest=TestHoodieTableMetadataUtil` -> `Tests run: 19, Failures: 0, Errors: 0` - `mvn test-compile checkstyle:check -pl hudi-hadoop-common` -> clean ### 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]
