orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasanthj <...@git.apache.org>
Subject [GitHub] orc pull request #84: ORC-132. Implement a merge file method and fix the num...
Date Thu, 19 Jan 2017 06:32:49 GMT
Github user prasanthj commented on a diff in the pull request:

    https://github.com/apache/orc/pull/84#discussion_r96799177
  
    --- Diff: java/core/src/test/org/apache/orc/TestVectorOrcFile.java ---
    @@ -2944,4 +2948,164 @@ public void testWriterVersion() throws Exception {
         assertEquals(OrcFile.WriterVersion.ORIGINAL, OrcFile.WriterVersion.from(0));
         assertEquals(OrcFile.WriterVersion.HIVE_4243, OrcFile.WriterVersion.from(2));
       }
    +
    +  /**
    +   * Test whether the file versions are translated correctly
    +   * @throws Exception
    +   */
    +  @Test
    +  public void testFileVersion() throws Exception {
    +    assertEquals(OrcFile.Version.V_0_11, ReaderImpl.getFileVersion(null));
    +    assertEquals(OrcFile.Version.V_0_11, ReaderImpl.getFileVersion(new ArrayList<Integer>()));
    +    assertEquals(OrcFile.Version.V_0_11,
    +        ReaderImpl.getFileVersion(Arrays.asList(new Integer[]{0, 11})));
    +    assertEquals(OrcFile.Version.V_0_12,
    +        ReaderImpl.getFileVersion(Arrays.asList(new Integer[]{0, 12})));
    +    assertEquals(OrcFile.Version.FUTURE,
    +        ReaderImpl.getFileVersion(Arrays.asList(new Integer[]{9999, 0})));
    +  }
    +
    +  @Test
    +  public void testMergeUnderstood() throws Exception {
    +    Path p = new Path("test.orc");
    +    Reader futureVersion = Mockito.mock(Reader.class);
    +    Mockito.when(futureVersion.getFileVersion()).thenReturn(OrcFile.Version.FUTURE);
    +    Mockito.when(futureVersion.getWriterVersion()).thenReturn(OrcFile.WriterVersion.HIVE_4243);
    +    assertEquals(false, OrcFile.understandFormat(p, futureVersion));
    +    Reader futureWriter = Mockito.mock(Reader.class);
    +    Mockito.when(futureWriter.getFileVersion()).thenReturn(OrcFile.Version.V_0_11);
    +    Mockito.when(futureWriter.getWriterVersion()).thenReturn(OrcFile.WriterVersion.FUTURE);
    +    assertEquals(false, OrcFile.understandFormat(p, futureWriter));
    +    Reader current = Mockito.mock(Reader.class);
    +    Mockito.when(current.getFileVersion()).thenReturn(OrcFile.Version.CURRENT);
    +    Mockito.when(current.getWriterVersion()).thenReturn(OrcFile.CURRENT_WRITER);
    +    assertEquals(true, OrcFile.understandFormat(p, current));
    +  }
    +
    +  static ByteBuffer fromString(String s) {
    +    return ByteBuffer.wrap(s.getBytes(StandardCharsets.UTF_8));
    +  }
    +
    +  static byte[] fromInt(int x) {
    +    return Integer.toHexString(x).getBytes(StandardCharsets.UTF_8);
    +  }
    +
    +  @Test
    +  public void testGoodMerge() throws Exception {
    --- End diff --
    
    ah! ok. Missed that. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message