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:27:03 UTC

[orc] branch branch-1.6 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 branch-1.6
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new ec77732  ORC-748: Add constants for Trino writer
ec77732 is described below

commit ec7773255b6a1f59c3704e687b6a29ebd13e5041
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 ca926cf..d521fdd 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 ef39a58..33f2806 100644
--- a/c++/src/Reader.cc
+++ b/c++/src/Reader.cc
@@ -491,7 +491,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 45249ef..6fef278 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 cee6bed..485f979 100644
--- a/java/core/src/test/org/apache/orc/TestVectorOrcFile.java
+++ b/java/core/src/test/org/apache/orc/TestVectorOrcFile.java
@@ -3320,6 +3320,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));
 
@@ -3336,6 +3338,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));
 
@@ -3352,6 +3356,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 06ab150..5e4f3bc 100644
--- a/proto/orc_proto.proto
+++ b/proto/orc_proto.proto
@@ -423,6 +423,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 db63356..2bf9f96 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 b84dac9..a1d46f7 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;