dossett commented on code in PR #3678:
URL: https://github.com/apache/parquet-java/pull/3678#discussion_r3624588713
##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HadoopInputFile.java:
##########
@@ -61,6 +65,27 @@ public static HadoopInputFile fromPath(Path path,
Configuration conf) throws IOE
return new HadoopInputFile(fs, fs.getFileStatus(path), conf);
}
+ /**
+ * Creates an input file using a caller-supplied file length.
+ *
+ * <p>The length is trusted and no file status lookup is performed. Callers
must provide the exact
+ * length of the file that will be opened. The file is not validated until
it is opened.
+ *
+ * @param path file path
+ * @param length exact file length in bytes
+ * @param conf configuration used to resolve the file system
+ * @return an input file that uses the supplied length
+ * @throws IllegalArgumentException if {@code length} is negative
+ * @throws IOException if the file system cannot be resolved
+ */
+ public static HadoopInputFile fromPath(Path path, long length, Configuration
conf) throws IOException {
+ if (length < 0) {
+ throw new IllegalArgumentException("Invalid file length: " + length);
+ }
+ FileSystem fs = path.getFileSystem(conf);
+ return new HadoopInputFile(fs, path, length, conf);
Review Comment:
Yes, does that suggest another change?
--
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]