Skip to content

Commit

Permalink
ORC-229. Add an UNSTABLE-PRE-2.0 file format version.
Browse files Browse the repository at this point in the history
Fixes #153

Signed-off-by: Owen O'Malley <omalley@apache.org>
  • Loading branch information
omalley committed Aug 14, 2017
1 parent cbb12a9 commit 3ea22f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions java/core/src/java/org/apache/orc/OrcFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ public class OrcFile {
public enum Version {
V_0_11("0.11", 0, 11),
V_0_12("0.12", 0, 12),

/**
* Do not use this format except for testing. It will not be compatible
* with other versions of the software. While we iterate on the ORC 2.0
* format, we will make incompatible format changes under this version
* without providing any forward or backward compatibility.
*
* When 2.0 is released, this version identifier will be completely removed.
*/
UNSTABLE_PRE_2_0("UNSTABLE-PRE-2.0", 1, 9999),

/**
* The generic identifier for all unknown versions.
*/
FUTURE("future", Integer.MAX_VALUE, Integer.MAX_VALUE);

public static final Version CURRENT = V_0_12;
Expand Down
7 changes: 7 additions & 0 deletions java/core/src/java/org/apache/orc/impl/WriterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ public Writer getWriter() {
this.bufferSize = getEstimatedBufferSize(adjustedStripeSize,
numColumns, opts.getBufferSize());
}
if (version == OrcFile.Version.FUTURE) {
throw new IllegalArgumentException("Can not write in a unknown version.");
} else if (version == OrcFile.Version.UNSTABLE_PRE_2_0) {
LOG.warn("ORC files written in " + version.getName() + " will not be" +
" readable by other versions of the software. It is only for" +
" developer testing.");
}
if (version == OrcFile.Version.V_0_11) {
/* do not write bloom filters for ORC v11 */
this.bloomFilterColumns = new boolean[schema.getMaximumId() + 1];
Expand Down

0 comments on commit 3ea22f3

Please sign in to comment.