dongjoon-hyun commented on a change in pull request #941: URL: https://github.com/apache/orc/pull/941#discussion_r736323428
########## File path: java/tools/src/test/org/apache/orc/tools/TestFileDump.java ########## @@ -709,6 +710,80 @@ public void testIndexOf() { byte[] bytes = ("OO" + OrcFile.MAGIC).getBytes(StandardCharsets.UTF_8); byte[] pattern = OrcFile.MAGIC.getBytes(StandardCharsets.UTF_8); - assertEquals(FileDump.indexOf(bytes, pattern, 1), 2); + assertEquals(2, FileDump.indexOf(bytes, pattern, 1)); + } + + @Test + public void testRecover() throws Exception { + TypeDescription schema = getMyRecordType(); + Writer writer = OrcFile.createWriter(testFilePath, + OrcFile.writerOptions(conf) + .fileSystem(fs) + .setSchema(schema)); + Random r1 = new Random(1); + String[] words = new String[]{"It", "was", "the", "best", "of", "times,", + "it", "was", "the", "worst", "of", "times,", "it", "was", "the", "age", + "of", "wisdom,", "it", "was", "the", "age", "of", "foolishness,", "it", + "was", "the", "epoch", "of", "belief,", "it", "was", "the", "epoch", + "of", "incredulity,", "it", "was", "the", "season", "of", "Light,", + "it", "was", "the", "season", "of", "Darkness,", "it", "was", "the", + "spring", "of", "hope,", "it", "was", "the", "winter", "of", "despair,", + "we", "had", "everything", "before", "us,", "we", "had", "nothing", + "before", "us,", "we", "were", "all", "going", "direct", "to", + "Heaven,", "we", "were", "all", "going", "direct", "the", "other", + "way"}; + VectorizedRowBatch batch = schema.createRowBatch(1000); + for(int i=0; i < 21000; ++i) { + appendMyRecord(batch, r1.nextInt(), r1.nextLong(), + words[r1.nextInt(words.length)]); + if (batch.size == batch.getMaxSize()) { + writer.addRowBatch(batch); + batch.reset(); + } + } + if (batch.size > 0) { + writer.addRowBatch(batch); + } + writer.close(); + + long fileSize = fs.getFileStatus(testFilePath).getLen(); + + String testFilePathStr = Path.mergePaths( + workDir, Path.mergePaths(new Path(Path.SEPARATOR), testFilePath)) + .toUri().getPath(); + + String copyTestFilePathStr = Path.mergePaths( + workDir, Path.mergePaths(new Path(Path.SEPARATOR), Review comment: Indentation looks inconsistent with line 752. -- 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: dev-unsubscr...@orc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org