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

weibin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git


The following commit(s) were added to refs/heads/main by this push:
     new 6a13df36 feat: make apache-arrow ORC extension optional (#558)
6a13df36 is described below

commit 6a13df36224e6c2dcbe70b729ac1cf48498eee7b
Author: Jingbo Xu <[email protected]>
AuthorDate: Mon Jul 29 18:13:13 2024 +0800

    feat: make apache-arrow ORC extension optional (#558)
    
    * add macro guard for arrow-orc.
    
    * tests revision.
    
    * trigger CI again.
    
    * make ci error info consistent.
    
    * fix a bug on ubuntu.
---
 .github/workflows/ci.yml            |  4 ++--
 cpp/CMakeLists.txt                  |  4 +++-
 cpp/src/graphar/filesystem.cc       | 10 ++++++++--
 cpp/src/graphar/reader_util.cc      |  2 ++
 cpp/test/test_arrow_chunk_writer.cc |  4 ++++
 cpp/test/test_builder.cc            |  1 -
 6 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 394c839d..6d4dea44 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -105,7 +105,7 @@ jobs:
             echo "|"
             echo "| Run: "
             echo "|"
-            echo "|    make clformat"
+            echo "|    make graphar-clformat"
             echo "|"
             echo "| to fix this error."
             echo "|"
@@ -124,7 +124,7 @@ jobs:
             echo 
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
             echo "| cpplint failures found! Run: "
             echo "|"
-            echo "|    make vineyard_cpplint"
+            echo "|    make graphar-cpplint"
             echo "|"
             echo "| to fix this error."
             echo 
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 23840e8d..bd7cfd30 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -197,7 +197,9 @@ if (${Arrow_VERSION} VERSION_GREATER_EQUAL "12.0.0")
 endif()
 # Check if ORC is enabled.
 if (NOT ${ARROW_ORC})
-    message(FATAL_ERROR "apache-arrow ORC extension is required.")
+    message(WARNING "apache-arrow is built without ORC extension, ORC related 
functionalities will be disabled.")
+else()
+    add_definitions(-DARROW_ORC) # Add macro, otherwise inconsistent in build 
phase on ubuntu.
 endif()
 
 find_package(Parquet QUIET)
diff --git a/cpp/src/graphar/filesystem.cc b/cpp/src/graphar/filesystem.cc
index 03c03e37..eb526d76 100644
--- a/cpp/src/graphar/filesystem.cc
+++ b/cpp/src/graphar/filesystem.cc
@@ -17,7 +17,9 @@
  * under the License.
  */
 
+#ifdef ARROW_ORC
 #include "arrow/adapters/orc/adapter.h"
+#endif
 #include "arrow/api.h"
 #include "arrow/csv/api.h"
 #include "arrow/dataset/api.h"
@@ -89,10 +91,12 @@ std::shared_ptr<ds::FileFormat> FileSystem::GetFileFormat(
     return std::make_shared<ds::CsvFileFormat>();
   case PARQUET:
     return std::make_shared<ds::ParquetFileFormat>();
-  case ORC:
-    return std::make_shared<ds::OrcFileFormat>();
   case JSON:
     return std::make_shared<ds::JsonFileFormat>();
+#ifdef ARROW_ORC
+  case ORC:
+    return std::make_shared<ds::OrcFileFormat>();
+#endif
   default:
     return nullptr;
   }
@@ -233,6 +237,7 @@ Status FileSystem::WriteTableToFile(const 
std::shared_ptr<arrow::Table>& table,
         builder.build(), parquet::default_arrow_writer_properties()));
     break;
   }
+#ifdef ARROW_ORC
   case FileType::ORC: {
     auto writer_options = arrow::adapters::orc::WriteOptions();
     writer_options.compression = arrow::Compression::type::ZSTD;
@@ -243,6 +248,7 @@ Status FileSystem::WriteTableToFile(const 
std::shared_ptr<arrow::Table>& table,
     RETURN_NOT_ARROW_OK(writer->Close());
     break;
   }
+#endif
   default:
     return Status::Invalid(
         "Unsupported file type: ", FileTypeToString(file_type), " for 
wrting.");
diff --git a/cpp/src/graphar/reader_util.cc b/cpp/src/graphar/reader_util.cc
index 9e23899d..0048c2bc 100644
--- a/cpp/src/graphar/reader_util.cc
+++ b/cpp/src/graphar/reader_util.cc
@@ -17,7 +17,9 @@
  * under the License.
  */
 
+#ifdef ARROW_ORC
 #include "arrow/adapters/orc/adapter.h"
+#endif
 #include "arrow/api.h"
 #include "arrow/csv/api.h"
 #include "arrow/filesystem/api.h"
diff --git a/cpp/test/test_arrow_chunk_writer.cc 
b/cpp/test/test_arrow_chunk_writer.cc
index 682c1a1a..cc35e25e 100644
--- a/cpp/test/test_arrow_chunk_writer.cc
+++ b/cpp/test/test_arrow_chunk_writer.cc
@@ -22,7 +22,9 @@
 #include <sstream>
 #include <string>
 
+#ifdef ARROW_ORC
 #include "arrow/adapters/orc/adapter.h"
+#endif
 #include "arrow/api.h"
 #include "arrow/csv/api.h"
 #include "arrow/filesystem/api.h"
@@ -112,6 +114,7 @@ TEST_CASE_METHOD(GlobalFixture, "TestVertexPropertyWriter") 
{
   auto pg3 = vertex_info->GetPropertyGroup("id");
   REQUIRE(writer->WriteTable(tmp_table, pg3, 0).IsTypeError());
 
+#ifdef ARROW_ORC
   SECTION("TestOrcParquetReader") {
     arrow::Status st;
     arrow::MemoryPool* pool = arrow::default_memory_pool();
@@ -150,6 +153,7 @@ TEST_CASE_METHOD(GlobalFixture, "TestVertexPropertyWriter") 
{
     REQUIRE(table1->GetColumnByName("gender")->ToString() ==
             table2->GetColumnByName("gender")->ToString());
   }
+#endif
 
   SECTION("TestEdgeChunkWriter") {
     arrow::Status st;
diff --git a/cpp/test/test_builder.cc b/cpp/test/test_builder.cc
index 7fecd9c6..63ebebc8 100644
--- a/cpp/test/test_builder.cc
+++ b/cpp/test/test_builder.cc
@@ -24,7 +24,6 @@
 #include <sstream>
 #include <string>
 
-#include "arrow/adapters/orc/adapter.h"
 #include "arrow/api.h"
 #include "arrow/csv/api.h"
 #include "arrow/filesystem/api.h"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to