You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/09/12 19:58:00 UTC

[orc] branch branch-1.5 updated: ORC-748: Add constants for Trino writer

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-1.5
in repository https://gitbox.apache.org/repos/asf/orc.git


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

commit a0b036c5dd16e54226942dae636b0a24fa8897af
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>
    (cherry picked from commit ec7773255b6a1f59c3704e687b6a29ebd13e5041)
    Signed-off-by: Dongjoon Hyun <do...@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                              | 7 +++++++
 site/specification/ORCv2.md                              | 7 +++++++
 7 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/c++/include/orc/Common.hh b/c++/include/orc/Common.hh
index b23d019..440c529 100644
--- a/c++/include/orc/Common.hh
+++ b/c++/include/orc/Common.hh
@@ -66,6 +66,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 f496df7..5e80a75 100644
--- a/c++/src/Reader.cc
+++ b/c++/src/Reader.cc
@@ -420,7 +420,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 5b15be2..5d2ddda 100644
--- a/java/core/src/java/org/apache/orc/OrcFile.java
+++ b/java/core/src/java/org/apache/orc/OrcFile.java
@@ -130,6 +130,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;
@@ -182,6 +183,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 33b5f87..5d9da7d 100644
--- a/java/core/src/test/org/apache/orc/TestVectorOrcFile.java
+++ b/java/core/src/test/org/apache/orc/TestVectorOrcFile.java
@@ -3215,6 +3215,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));
 
@@ -3231,6 +3233,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));
 
@@ -3247,6 +3251,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 e53c1c4..6ad396f 100644
--- a/proto/orc_proto.proto
+++ b/proto/orc_proto.proto
@@ -270,6 +270,9 @@ message PostScript {
   // Version of the Scritchley Go writer:
   //   6 = original
   //
+  // Version of the Trino writer:
+  //   6 = original
+  //
   optional uint32 writerVersion = 6;
 
   // Leave this last in the record
diff --git a/site/specification/ORCv1.md b/site/specification/ORCv1.md
index 2101759..baba001 100644
--- a/site/specification/ORCv1.md
+++ b/site/specification/ORCv1.md
@@ -120,6 +120,13 @@ information as described in this section.
  repeated ColumnStatistics statistics = 7;
  // the maximum number of rows in each index entry
  optional uint32 rowIndexStride = 8;
+ // Each implementation that writes ORC files should register for a code
+ // 0 = ORC Java
+ // 1 = ORC C++
+ // 2 = Presto
+ // 3 = Scritchley Go from https://github.com/scritchley/orc
+ // 4 = Trino
+ optional uint32 writer = 9;
 }
 ```
 
diff --git a/site/specification/ORCv2.md b/site/specification/ORCv2.md
index 8f73065..6d0d3df 100644
--- a/site/specification/ORCv2.md
+++ b/site/specification/ORCv2.md
@@ -140,6 +140,13 @@ information as described in this section.
  repeated ColumnStatistics statistics = 7;
  // the maximum number of rows in each index entry
  optional uint32 rowIndexStride = 8;
+ // Each implementation that writes ORC files should register for a code
+ // 0 = ORC Java
+ // 1 = ORC C++
+ // 2 = Presto
+ // 3 = Scritchley Go from https://github.com/scritchley/orc
+ // 4 = Trino
+ optional uint32 writer = 9;
 }
 ```