iajoiner commented on a change in pull request #9702:
URL: https://github.com/apache/arrow/pull/9702#discussion_r758913948



##########
File path: cpp/src/arrow/adapters/orc/adapter_options.cc
##########
@@ -0,0 +1,283 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/adapters/orc/adapter_options.h"
+
+#include "arrow/adapters/orc/adapter.h"
+#include "orc/Common.hh"
+#include "orc/Int128.hh"
+#include "orc/Writer.hh"
+
+namespace liborc = orc;
+
+namespace arrow {
+
+namespace adapters {
+
+namespace orc {
+
+std::string FileVersion::ToString() const {
+  std::stringstream ss;
+  ss << major() << '.' << minor();
+  return ss.str();
+}
+
+const FileVersion& FileVersion::v_0_11() {
+  static FileVersion version(0, 11);
+  return version;
+}
+
+const FileVersion& FileVersion::v_0_12() {
+  static FileVersion version(0, 12);
+  return version;
+}
+
+struct WriterOptionsPrivate {
+  uint64_t stripe_size_;
+  uint64_t compression_block_size_;
+  uint64_t row_index_stride_;
+  CompressionKind compression_;
+  CompressionStrategy compression_strategy_;
+  liborc::MemoryPool* memory_pool_;
+  double padding_tolerance_;
+  std::ostream* error_stream_;
+  FileVersion file_version_;
+  double dictionary_key_size_threshold_;
+  bool enable_index_;
+  std::set<uint64_t> columns_use_bloom_filter_;
+  double bloom_filter_false_positive_prob_;
+  BloomFilterVersion bloom_filter_version_;
+
+  WriterOptionsPrivate() : file_version_(FileVersion::v_0_12()) {
+    stripe_size_ = 64 * 1024 * 1024;      // 64M
+    compression_block_size_ = 64 * 1024;  // 64K
+    row_index_stride_ = 10000;
+    compression_ = CompressionKind_ZLIB;
+    compression_strategy_ = CompressionStrategy_SPEED;
+    memory_pool_ = liborc::getDefaultPool();
+    padding_tolerance_ = 0.0;
+    error_stream_ = &std::cerr;
+    dictionary_key_size_threshold_ = 0.0;
+    enable_index_ = true;
+    bloom_filter_false_positive_prob_ = 0.05;
+    bloom_filter_version_ = UTF8;
+  }
+};
+
+WriterOptions::WriterOptions()
+    : private_bits_(std::unique_ptr<WriterOptionsPrivate>(new 
WriterOptionsPrivate())) {
+  // PASS
+}
+
+WriterOptions::WriterOptions(const WriterOptions& rhs)
+    : private_bits_(std::unique_ptr<WriterOptionsPrivate>(
+          new WriterOptionsPrivate(*(rhs.private_bits_.get())))) {
+  // PASS
+}
+
+WriterOptions::WriterOptions(WriterOptions& rhs) {
+  // swap private_bits with rhs
+  private_bits_.swap(rhs.private_bits_);
+}
+
+WriterOptions& WriterOptions::operator=(const WriterOptions& rhs) {
+  if (this != &rhs) {
+    private_bits_.reset(new WriterOptionsPrivate(*(rhs.private_bits_.get())));
+  }
+  return *this;
+}
+
+WriterOptions::~WriterOptions() {
+  // PASS
+}
+RleVersion WriterOptions::rle_version() const {
+  if (private_bits_->file_version_ == FileVersion::v_0_11()) {
+    return RleVersion_1;
+  }
+
+  return RleVersion_2;
+}
+
+WriterOptions& WriterOptions::set_stripe_size(uint64_t size) {
+  private_bits_->stripe_size_ = size;

Review comment:
       I do think your proposal is shorter and more straightforward. More 
importantly we shouldn't keep a copy of ORC internals ourselves that can easily 
become outdated as ORC changes. I will make the change.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to