Rajeev-01 opened a new pull request, #19596:
URL: https://github.com/apache/hudi/pull/19596

   ### Describe the issue this Pull Request addresses
   
   - closes https://github.com/apache/hudi/issues/19595 
   
   - This PR addresses the NPE issues that we face while fetching the avro 
version during runtime.
   `at java.base/java.lang.Thread.run(Thread.java:840) Caused by: 
java.lang.NullPointerException: Cannot invoke 
"String.toLowerCase(java.util.Locale)" because "version" is null
   at 
org.apache.hudi.common.util.ComparableVersion.parseVersion(ComparableVersion.java:317)
   at 
org.apache.hudi.common.util.ComparableVersion.<init>(ComparableVersion.java:309)
   at 
org.apache.hudi.common.util.StringUtils.compareVersions(StringUtils.java:224)
   at 
org.apache.hudi.avro.HoodieAvroUtils.gteqAvro1_12(HoodieAvroUtils.java:1337)
   at 
org.apache.hudi.avro.HoodieAvroUtils.convertDefaultValueForAvroCompatibility(HoodieAvroUtils.java:1341)
   `
   
   ### Summary and Changelog
   
   - Current implementation 
`Schema.class.getPackage().getImplementationVersion()` will return `null` if 
the avro jar is not being passed as runtime dependency but included as a part 
of current fat / shaded jar. 
   - Created the method `HoodieAvroUtils#resolveAvroVersion()` to get the avro 
version from the pom.properties of the current fat jar.
   - If it's not present, falling back to default behavior. 
   - Replaced the same in `AvroSchemaConverterWithTimestampNTZ` class as well 
to keep the consistent behavior.
   
   ### Impact
   
   - Will remove the NPE while resolving the avro version and works for both 
cases where avro jar brought as runtime dependency or include in fat jar.
   
   ### Risk Level
   
   low
   
   ### Documentation Update
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] 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]

Reply via email to