You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2021/02/08 23:25:37 UTC
[orc] branch master updated: ORC-748: Add constants for Trino writer
This is an automated email from the ASF dual-hosted git repository.
omalley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/master by this push:
new e39fd44 ORC-748: Add constants for Trino writer
e39fd44 is described below
commit e39fd44cbc320bd2e69405913e61dc81a87528f3
Author: Piotr Findeisen <pi...@gmail.com>
AuthorDate: Mon Feb 8 22:40:20 2021 +0100
ORC-748: Add constants for Trino writer
Fixes #640
Signed-off-by: Owen O'Malley <om...@apache.org>
---
c++/include/orc/Common.hh | 2 ++
c++/src/Reader.cc | 2 +-
java/core/src/java/org/apache/orc/OrcFile.java | 4 ++++
java/core/src/test/org/apache/orc/TestVectorOrcFile.java | 6 ++++++
proto/orc_proto.proto | 3 +++
site/specification/ORCv1.md | 1 +
site/specification/ORCv2.md | 1 +
7 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/c++/include/orc/Common.hh b/c++/include/orc/Common.hh
index 448f288..09d1fb3 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 8df6f42..37225b9 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<WriterId>(id);
diff --git a/java/core/src/java/org/apache/orc/OrcFile.java b/java/core/src/java/org/apache/orc/OrcFile.java
index 2e06f52..4e5b391 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 class OrcFile {
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 class OrcFile {
// 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 bedf4a5..e66cbac 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 class TestVectorOrcFile {
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 class TestVectorOrcFile {
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 class TestVectorOrcFile {
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 380d66a..0ffd681 100644
--- a/proto/orc_proto.proto
+++ b/proto/orc_proto.proto
@@ -424,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 812c962..d4cdbc5 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 74eb567..ebba1a7 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;