parthchandra commented on code in PR #2031:
URL: https://github.com/apache/datafusion-comet/pull/2031#discussion_r2210968794


##########
native/hdfs/src/object_store/hdfs.rs:
##########
@@ -88,19 +88,18 @@ impl HadoopFileSystem {
 
     fn read_range(range: &Range<u64>, file: &HdfsFile) -> Result<Bytes> {
         let to_read = (range.end - range.start) as usize;
+        let mut total_read = 0u64;
         let mut buf = vec![0; to_read];
-        let read = file
-            .read_with_pos(range.start as i64, buf.as_mut_slice())
-            .map_err(to_error)?;
-        assert_eq!(
-            to_read as i32,
-            read,
-            "Read path {} from {} with expected size {} and actual size {}",
-            file.path(),
-            range.start,
-            to_read,
-            read
-        );
+        while total_read < to_read as u64 {
+            let read =
+             file
+                .read_with_pos((range.start + total_read) as i64, 
buf[total_read as usize..].as_mut())
+                .map_err(to_error)?;
+            if read == -1 {
+                break;

Review Comment:
   Thanks for catching this @Kontinuation! I based this on the return value of 
`FSDataInputStream`, but looks like both `fs-hdfs` and the official hadoop 
`libhdfs` behave differently.
   Let me address this.
   In `fs-hdfs` 
        : a return value < 0 is an error
        : a return value of 0 is OK even if the buffer is not fully read into. 
However, it looks like other object store implementations treat this as an 
error. So I will treat both as an error (maybe reintroduce the original 
assertion).
        



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to