diff --git a/c++/include/orc/Common.hh b/c++/include/orc/Common.hh index 448f288f24..09d1fb3088 100644 --- a/c++/include/orc/Common.hh +++ b/c++/include/orc/Common.hh @@ -69,6 +69,8 @@ namespace orc { ORC_JAVA_WRITER = 0, ORC_CPP_WRITER = 1, PRESTO_WRITER = 2, + SCRITCHLEY_GO = 3, + TRINO_WRITER = 4, UNKNOWN_WRITER = INT32_MAX }; diff --git a/c++/src/Reader.cc b/c++/src/Reader.cc index 8df6f42496..37225b9936 100644 --- a/c++/src/Reader.cc +++ b/c++/src/Reader.cc @@ -498,7 +498,7 @@ namespace orc { WriterId ReaderImpl::getWriterId() const { if (footer->has_writer()) { uint32_t id = footer->writer(); - if (id > WriterId::PRESTO_WRITER) { + if (id > WriterId::TRINO_WRITER) { return WriterId::UNKNOWN_WRITER; } else { return static_cast(id); diff --git a/java/core/src/java/org/apache/orc/OrcFile.java b/java/core/src/java/org/apache/orc/OrcFile.java index 2e06f525f5..4e5b391826 100644 --- a/java/core/src/java/org/apache/orc/OrcFile.java +++ b/java/core/src/java/org/apache/orc/OrcFile.java @@ -131,6 +131,7 @@ public enum WriterImplementation { ORC_CPP(1), // ORC C++ writer PRESTO(2), // Presto writer SCRITCHLEY_GO(3), // Go writer from https://github.com/scritchley/orc + TRINO(4), // Trino writer UNKNOWN(Integer.MAX_VALUE); private final int id; @@ -185,6 +186,9 @@ public enum WriterVersion { // Scritchley Go Writer SCRITCHLEY_GO_ORIGINAL(WriterImplementation.SCRITCHLEY_GO, 6), + // Trino Writer + TRINO_ORIGINAL(WriterImplementation.TRINO, 6), + // Don't use any magic numbers here except for the below: FUTURE(WriterImplementation.UNKNOWN, Integer.MAX_VALUE); // a version from a future writer diff --git a/java/core/src/test/org/apache/orc/TestVectorOrcFile.java b/java/core/src/test/org/apache/orc/TestVectorOrcFile.java index bedf4a5e70..e66cbacdd2 100644 --- a/java/core/src/test/org/apache/orc/TestVectorOrcFile.java +++ b/java/core/src/test/org/apache/orc/TestVectorOrcFile.java @@ -3423,6 +3423,8 @@ public void testWriterVersion() throws Exception { OrcFile.WriterImplementation.from(1)); assertEquals(OrcFile.WriterImplementation.PRESTO, OrcFile.WriterImplementation.from(2)); + assertEquals(OrcFile.WriterImplementation.TRINO, + OrcFile.WriterImplementation.from(4)); assertEquals(OrcFile.WriterImplementation.UNKNOWN, OrcFile.WriterImplementation.from(99)); @@ -3439,6 +3441,8 @@ public void testWriterVersion() throws Exception { OrcFile.WriterVersion.from(OrcFile.WriterImplementation.ORC_CPP, 6)); assertEquals(OrcFile.WriterVersion.PRESTO_ORIGINAL, OrcFile.WriterVersion.from(OrcFile.WriterImplementation.PRESTO, 6)); + assertEquals(OrcFile.WriterVersion.TRINO_ORIGINAL, + OrcFile.WriterVersion.from(OrcFile.WriterImplementation.TRINO, 6)); assertEquals(OrcFile.WriterVersion.FUTURE, OrcFile.WriterVersion.from(OrcFile.WriterImplementation.UNKNOWN, 0)); @@ -3455,6 +3459,8 @@ public void testWriterVersion() throws Exception { OrcFile.WriterVersion.HIVE_12055)); assertTrue(OrcFile.WriterVersion.HIVE_12055.includes( OrcFile.WriterVersion.PRESTO_ORIGINAL)); + assertTrue(OrcFile.WriterVersion.HIVE_12055.includes( + OrcFile.WriterVersion.TRINO_ORIGINAL)); } @Test(expected=IllegalArgumentException.class) diff --git a/proto/orc_proto.proto b/proto/orc_proto.proto index 06ab1509ed..0ffd68116b 100644 --- a/proto/orc_proto.proto +++ b/proto/orc_proto.proto @@ -366,6 +366,7 @@ message Footer { // 1 = ORC C++ // 2 = Presto // 3 = Scritchley Go from https://github.com/scritchley/orc + // 4 = Trino optional uint32 writer = 9; // information about the encryption in this file @@ -423,6 +424,9 @@ message PostScript { // Version of the Scritchley Go writer: // 6 = original // + // Version of the Trino writer: + // 6 = original + // optional uint32 writerVersion = 6; // the number of bytes in the encrypted stripe statistics diff --git a/site/specification/ORCv1.md b/site/specification/ORCv1.md index 812c96219d..d4cdbc5512 100644 --- a/site/specification/ORCv1.md +++ b/site/specification/ORCv1.md @@ -135,6 +135,7 @@ message Footer { // 1 = ORC C++ // 2 = Presto // 3 = Scritchley Go from https://github.com/scritchley/orc + // 4 = Trino optional uint32 writer = 9; // information about the encryption in this file optional Encryption encryption = 10; diff --git a/site/specification/ORCv2.md b/site/specification/ORCv2.md index 74eb567346..ebba1a7034 100644 --- a/site/specification/ORCv2.md +++ b/site/specification/ORCv2.md @@ -155,6 +155,7 @@ message Footer { // 1 = ORC C++ // 2 = Presto // 3 = Scritchley Go from https://github.com/scritchley/orc + // 4 = Trino optional uint32 writer = 9; // information about the encryption in this file optional Encryption encryption = 10;