[ 
https://issues.apache.org/jira/browse/HADOOP-19098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17830898#comment-17830898
 ] 

ASF GitHub Bot commented on HADOOP-19098:
-----------------------------------------

steveloughran commented on code in PR #6604:
URL: https://github.com/apache/hadoop/pull/6604#discussion_r1539064441


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/VectoredReadUtils.java:
##########
@@ -133,26 +172,42 @@ private static void 
readNonByteBufferPositionedReadable(PositionedReadable strea
   /**
    * Read bytes from stream into a byte buffer using an
    * intermediate byte array.
-   * @param length number of bytes to read.
+   *   <pre>
+   *     (position, buffer, buffer-offset, length): Void
+   *     position:= the position within the file to read data.
+   *     buffer := a buffer to read fully `length` bytes into.
+   *     buffer-offset := the offset within the buffer to write data
+   *     length := the number of bytes to read.
+   *   </pre>
+   * The passed in function MUST block until the required length of
+   * data is read, or an exception is thrown.
+   * @param range range to read
    * @param buffer buffer to fill.
    * @param operation operation to use for reading data.
    * @throws IOException any IOE.
    */
-  public static void readInDirectBuffer(int length,
-                                        ByteBuffer buffer,
-                                        Function4RaisingIOE<Integer, byte[], 
Integer,
-                                                Integer, Void> operation) 
throws IOException {
+  public static void readInDirectBuffer(FileRange range,
+      ByteBuffer buffer,
+      Function4RaisingIOE<Long, byte[], Integer, Integer, Void> operation)
+      throws IOException {
+
+    LOG.debug("Reading {} into a direct buffer", range);
+    validateRangeRequest(range);

Review Comment:
   because it is a public method called by the filesystems, and I'm just being 
rigorous. it is a low cost probe





> Vector IO: consistent specified rejection of overlapping ranges
> ---------------------------------------------------------------
>
>                 Key: HADOOP-19098
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19098
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs, fs/s3
>    Affects Versions: 3.3.6
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Major
>              Labels: pull-request-available
>
> Related to PARQUET-2171 q: "how do you deal with overlapping ranges?"
> I believe s3a rejects this, but the other impls may not.
> Proposed
> FS spec to say 
> * "overlap triggers IllegalArgumentException". 
> * special case: 0 byte ranges may be short circuited to return empty buffer 
> even without checking file length etc.
> Contract tests to validate this
> (+ common helper code to do this).
> I'll copy the validation stuff into the parquet PR for consistency with older 
> releases



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to