This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new fe4e1e186 [test] Fix flaky test VectoredReadUtilsTest.testRandom 
(#3446)
fe4e1e186 is described below

commit fe4e1e1864143a211f2ace35bce3bb9d7ab9edc3
Author: Zouxxyy <[email protected]>
AuthorDate: Thu May 30 23:09:11 2024 +0800

    [test] Fix flaky test VectoredReadUtilsTest.testRandom (#3446)
---
 .../src/main/java/org/apache/paimon/fs/VectoredReadUtils.java      | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/paimon-common/src/main/java/org/apache/paimon/fs/VectoredReadUtils.java 
b/paimon-common/src/main/java/org/apache/paimon/fs/VectoredReadUtils.java
index 156bdb81f..e55ac882b 100644
--- a/paimon-common/src/main/java/org/apache/paimon/fs/VectoredReadUtils.java
+++ b/paimon-common/src/main/java/org/apache/paimon/fs/VectoredReadUtils.java
@@ -53,8 +53,8 @@ public class VectoredReadUtils {
 
         int parallelism = readable.parallelismForVectorReads();
 
-        if (combinedRanges.size() == 1) {
-            fallbackToReadSequence(readable, sortRanges);
+        if (combinedRanges.size() == 1 && readable instanceof 
SeekableInputStream) {
+            fallbackToReadSequence((SeekableInputStream) readable, sortRanges);
             return;
         }
 
@@ -78,8 +78,7 @@ public class VectoredReadUtils {
     }
 
     private static void fallbackToReadSequence(
-            VectoredReadable readable, List<? extends FileRange> ranges) 
throws IOException {
-        SeekableInputStream in = (SeekableInputStream) readable;
+            SeekableInputStream in, List<? extends FileRange> ranges) throws 
IOException {
         for (FileRange range : ranges) {
             byte[] bytes = new byte[range.getLength()];
             in.seek(range.getOffset());

Reply via email to