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


##########
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:
   Agree, otherwise the function result is probably not  predictable. 



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