manika137 commented on code in PR #8153:
URL: https://github.com/apache/hadoop/pull/8153#discussion_r2671707670
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsInputStream.java:
##########
@@ -937,6 +952,92 @@ public void
testPrefetchReadAddsPriorityHeaderWithDifferentConfigs()
executePrefetchReadTest(tracingContext1, configuration1, false);
}
+ /**
+ * Test to verify that the correct AbfsInputStream instance is created
+ * based on the read policy set in AbfsConfiguration.
+ */
+ @Test
+ public void testAbfsInputStreamInstance() throws Exception {
+ AzureBlobFileSystem fs = getFileSystem();
+ Path path = new Path("/testPath");
+ fs.create(path).close();
+
+ // Assert that Sequential Read Policy uses Prefetch Input Stream
+
getAbfsStore(fs).getAbfsConfiguration().setAbfsReadPolicy(FS_OPTION_OPENFILE_READ_POLICY_SEQUENTIAL);
+ InputStream stream = fs.open(path).getWrappedStream();
+ assertThat(stream).isInstanceOf(AbfsPrefetchInputStream.class);
+ stream.close();
+
+ // Assert that Adaptive Read Policy uses Adaptive Input Stream
+
getAbfsStore(fs).getAbfsConfiguration().setAbfsReadPolicy(FS_OPTION_OPENFILE_READ_POLICY_ADAPTIVE);
+ stream = fs.open(path).getWrappedStream();
+ assertThat(stream).isInstanceOf(AbfsAdaptiveInputStream.class);
+ stream.close();
+
+ // Assert that Parquet Read Policy uses Random Input Stream
+
getAbfsStore(fs).getAbfsConfiguration().setAbfsReadPolicy(FS_OPTION_OPENFILE_READ_POLICY_PARQUET);
+ stream = fs.open(path).getWrappedStream();
+ assertThat(stream).isInstanceOf(AbfsRandomInputStream.class);
+ stream.close();
+
+ // Assert that Avro Read Policy uses Adaptive Input Stream
+
getAbfsStore(fs).getAbfsConfiguration().setAbfsReadPolicy(FS_OPTION_OPENFILE_READ_POLICY_AVRO);
+ stream = fs.open(path).getWrappedStream();
+ assertThat(stream).isInstanceOf(AbfsAdaptiveInputStream.class);
+ stream.close();
+ }
+
+ @Test
+ public void testRandomInputStreamDoesNotQueuePrefetches() throws Exception {
Review Comment:
nit: javadoc
--
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]