rdblue commented on code in PR #6293:
URL: https://github.com/apache/iceberg/pull/6293#discussion_r1041610117
##########
orc/src/test/java/org/apache/iceberg/orc/TestOrcDataWriter.java:
##########
@@ -126,4 +135,116 @@ public void testDataWriter() throws IOException {
Assert.assertEquals("Written records should match", records,
writtenRecords);
}
+
+ @Test
+ public void testUsingFileIO() throws IOException {
+ // Show that FileSystem access is not possible for the file we are
supplying as the scheme
+ // dummy is not handled
+ ProxyOutputFile outFile = new
ProxyOutputFile(Files.localOutput(temp.newFile()));
+ Assertions.assertThatThrownBy(
+ () -> HadoopOutputFile.fromPath(new Path(outFile.location()), new
Configuration()))
+ .isInstanceOf(RuntimeIOException.class)
+ .hasMessageStartingWith("Failed to get file system for path: dummy");
+
+ // We are creating the proxy
+ SortOrder sortOrder =
SortOrder.builderFor(SCHEMA).withOrderId(10).asc("id").build();
+
+ DataWriter<Record> dataWriter =
+ ORC.writeData(outFile)
+ .schema(SCHEMA)
+ .createWriterFunc(GenericOrcWriter::buildWriter)
+ .overwrite()
+ .withSpec(PartitionSpec.unpartitioned())
+ .withSortOrder(sortOrder)
+ .build();
+
+ try {
+ for (Record record : records) {
+ dataWriter.write(record);
+ }
+ } finally {
+ dataWriter.close();
+ }
+
+ DataFile dataFile = dataWriter.toDataFile();
+ OrcFile.ReaderOptions options =
+ OrcFile.readerOptions(new Configuration())
+ .filesystem(new ORC.InputFileSystem(outFile.toInputFile()))
+ .maxLength(outFile.toInputFile().getLength());
Review Comment:
I think this should use the `newFileReader` method rather than creating
options here.
--
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]