suryaprasanna opened a new pull request, #17933: URL: https://github.com/apache/hudi/pull/17933
### Describe the issue this Pull Request addresses When upgrading datasets from table version 3 to 6, non-partitioned datasets encounter an ArrayIndexOutOfBoundsException during the FourToFiveUpgrade process. Starting from Hudi 0.12, support for default partitionPath was removed. During the upgrade, a check for the default partitionPath existence is performed, but the code attempts to access `partitions[0]` without first verifying that the partitions array is non-empty. ### Summary and Changelog This PR adds a defensive check to prevent ArrayIndexOutOfBoundsException for non-partitioned datasets during table version upgrades. **Changes:** - Added array length check before accessing partition fields in FourToFiveUpgradeHandler - Ensures `partitions.length > 0` before attempting to access `partitions[0]` - Prevents crash during upgrade for non-partitioned datasets with hive-style partitioning enabled ### Impact Fixes table version upgrade failures for non-partitioned datasets. No impact to public APIs or user-facing features beyond the bug fix. ### Risk Level **Low** - Defensive fix that adds a bounds check before array access. Prevents a crash condition for non-partitioned datasets during upgrade. ### 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]
