stuxuhai opened a new pull request, #9491:
URL: https://github.com/apache/ozone/pull/9491

   ## What changes were proposed in this pull request?
   
   Currently, the Ozone File System (OzoneFileSystem) client's implementation 
of `org.apache.hadoop.fs.LocatedFileStatus.getBlockLocations()` returns 
**null** when the file size is **0 bytes**.
   
   This behavior is inconsistent with the **HDFS File System client**, which 
correctly returns an **empty `BlockLocation[]` array** for zero-byte files, as 
per the standard Hadoop FileSystem API contract for files with no blocks.
   
   **This commit addresses the compatibility issue by modifying 
`OzoneFileSystem` to return an empty `BlockLocation[]` array when:**
   1. The file size is 0.
   2. The internal block list is empty (which is true for 0-byte files).
   
   This change ensures better interoperability and seamless compatibility for 
applications relying on the expected behavior of the Hadoop FileSystem API.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-14161
   
   ## How was this patch tested?
   
   add unit tests


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to