pitrou commented on a change in pull request #8088:
URL: https://github.com/apache/arrow/pull/8088#discussion_r481195407
##########
File path: cpp/src/arrow/ipc/metadata_internal.cc
##########
@@ -1159,7 +1159,7 @@ Status GetKeyValueMetadata(const KVVector* fb_metadata,
auto metadata = std::make_shared<KeyValueMetadata>();
metadata->reserve(fb_metadata->size());
- for (const auto& pair : *fb_metadata) {
+ for (const auto pair : *fb_metadata) {
Review comment:
Was there a problem here?
##########
File path: cpp/src/arrow/array/builder_base.h
##########
@@ -56,6 +56,8 @@ class ARROW_EXPORT ArrayBuilder {
/// skip shared pointers and just return a raw pointer
ArrayBuilder* child(int i) { return children_[i].get(); }
+ std::shared_ptr<ArrayBuilder> child_builder(int i) const { return
children_[i]; }
Review comment:
`const shared_ptr&` perhaps?
##########
File path: cpp/src/arrow/util/converter.h
##########
@@ -0,0 +1,248 @@
+// 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 <datetime.h>
+
+#include <algorithm>
+#include <iostream>
+#include <limits>
+#include <map>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "arrow/array.h"
+#include "arrow/builder.h"
+#include "arrow/chunked_array.h"
+#include "arrow/status.h"
+#include "arrow/type.h"
+#include "arrow/type_traits.h"
+#include "arrow/util/checked_cast.h"
+#include "arrow/util/decimal.h"
+#include "arrow/util/int_util_internal.h"
+#include "arrow/util/logging.h"
+
+#include "arrow/visitor_inline.h"
+
+namespace arrow {
+
+using internal::checked_cast;
+using internal::checked_pointer_cast;
+
+template <typename I, typename O>
Review comment:
Please avoid cryptic one-letter names. Instead `InputType`,
`OptionsType`.
##########
File path: cpp/src/arrow/util/converter.h
##########
@@ -0,0 +1,248 @@
+// 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 <datetime.h>
+
+#include <algorithm>
+#include <iostream>
+#include <limits>
+#include <map>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "arrow/array.h"
+#include "arrow/builder.h"
+#include "arrow/chunked_array.h"
+#include "arrow/status.h"
+#include "arrow/type.h"
+#include "arrow/type_traits.h"
+#include "arrow/util/checked_cast.h"
+#include "arrow/util/decimal.h"
+#include "arrow/util/int_util_internal.h"
+#include "arrow/util/logging.h"
+
+#include "arrow/visitor_inline.h"
+
+namespace arrow {
+
+using internal::checked_cast;
+using internal::checked_pointer_cast;
+
+template <typename I, typename O>
+class ARROW_EXPORT ArrayConverter {
+ public:
+ using InputType = I;
+ using OptionsType = O;
+
+ ArrayConverter(const std::shared_ptr<DataType>& type,
+ std::shared_ptr<ArrayBuilder> builder, O options)
+ : sp_type_(type), sp_builder_(builder), options_(options) {}
+
+ virtual ~ArrayConverter() = default;
+ std::shared_ptr<ArrayBuilder> builder() { return sp_builder_; }
+ std::shared_ptr<ArrayBuilder> type() { return sp_type_; }
+ O options() { return options_; }
+
+ virtual Status Init() { return Status::OK(); };
+ virtual Status Reserve(int64_t additional_capacity) = 0;
+
+ virtual Status Append(I value) = 0;
+ virtual Status AppendNull() = 0;
+
+ virtual Status Extend(I seq, int64_t size) = 0;
+
+ virtual Result<std::shared_ptr<Array>> Finish() = 0;
+
+ // virtual Result<std::shared_ptr<Array>> ToArray(I value);
+ // virtual Result<std::shared_ptr<ChunkedArray>> ToChunkedArray(I value);
+
+ protected:
+ const std::shared_ptr<DataType> sp_type_;
+ std::shared_ptr<ArrayBuilder> sp_builder_;
+ O options_;
+};
+
+template <typename T, typename AC>
+class ARROW_EXPORT TypedArrayConverter : public AC {
Review comment:
I don't expect to have to pass the base class myself as a template
argument. It should be inferred?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]