davisusanibar commented on code in PR #14182:
URL: https://github.com/apache/arrow/pull/14182#discussion_r989536172
##########
java/dataset/src/test/java/org/apache/arrow/dataset/file/TestFileSystemDataset.java:
##########
@@ -361,6 +362,30 @@ public void testBaseOrcRead() throws Exception {
AutoCloseables.close(factory);
}
+ @Test
+ public void testBaseCsvRead() throws Exception {
+ CsvWriteSupport writeSupport = CsvWriteSupport.writeTempFile(
+ TMP.newFolder(), "Name,Language", "Juno,Java", "Peter,Python",
"Celin,C++");
+ String expectedJsonUnordered = "[[\"Juno\", \"Java\"], [\"Peter\",
\"Python\"], [\"Celin\", \"C++\"]]";
+ FileSystemDatasetFactory factory = new
FileSystemDatasetFactory(rootAllocator(), NativeMemoryPool.getDefault(),
+ FileFormat.CSV, writeSupport.getOutputURI());
+
+ ScanOptions options = new ScanOptions(100);
+ Schema schema = inferResultSchemaFromFactory(factory, options);
+ List<ArrowRecordBatch> datum = collectResultFromFactory(factory, options);
+
+ System.out.println(schema);
+ assertScanBatchesProduced(factory, options);
+ assertEquals(1, datum.size());
+ assertEquals(2, schema.getFields().size());
+ assertEquals("Name", schema.getFields().get(0).getName());
+
+ checkParquetReadResult(schema, expectedJsonUnordered, datum);
+
+ AutoCloseables.close(datum);
Review Comment:
Added try-with for `FileSystemDatasetFactory` but don't know how to add that
for`List<ArrowRecordBatch>` that is an input for another function.
--
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]