Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1658#discussion_r18613254
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -836,6 +839,84 @@ public void sequenceFile() {
         Assert.assertEquals(pairs, readRDD.collect());
       }
     
    +    @Test
    +    public void binaryFiles() throws Exception {
    +        // Reusing the wholeText files example
    +        byte[] content1 = "spark is easy to use.\n".getBytes("utf-8");
    +
    +
    +        String tempDirName = tempDir.getAbsolutePath();
    +        File file1 = new File(tempDirName + "/part-00000");
    +
    +        FileOutputStream fos1 = new FileOutputStream(file1);
    +
    +        FileChannel channel1 = fos1.getChannel();
    +        ByteBuffer bbuf = java.nio.ByteBuffer.wrap(content1);
    +        channel1.write(bbuf);
    +        channel1.close();
    +        JavaPairRDD<String, PortableDataStream> readRDD = 
sc.binaryFiles(tempDirName,3);
    +        List<Tuple2<String, PortableDataStream>> result = 
readRDD.collect();
    +        for (Tuple2<String, PortableDataStream> res : result) {
    +            Assert.assertArrayEquals(content1, res._2().toArray());
    +        }
    --- End diff --
    
    Test the versions of the methods that take only one argument too (the main 
purpose of the Java API suite is to make sure all these methods are callable 
from Java, this is why it's useful to add calls to them even if they're not 
doing much)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to