lidavidm commented on a change in pull request #10511:
URL: https://github.com/apache/arrow/pull/10511#discussion_r660071017



##########
File path: cpp/src/arrow/compute/function_internal.h
##########
@@ -0,0 +1,565 @@
+// 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.
+
+#pragma once
+
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "arrow/array/builder_base.h"
+#include "arrow/array/builder_binary.h"
+#include "arrow/array/builder_nested.h"
+#include "arrow/compute/function.h"
+#include "arrow/compute/type_fwd.h"
+#include "arrow/result.h"
+#include "arrow/status.h"
+#include "arrow/util/checked_cast.h"
+#include "arrow/util/key_value_metadata.h"
+#include "arrow/util/reflection_internal.h"
+#include "arrow/util/string.h"
+#include "arrow/util/visibility.h"
+
+namespace arrow {
+struct Scalar;
+struct StructScalar;
+using ::arrow::internal::checked_cast;
+namespace compute {
+namespace internal {
+ARROW_EXPORT
+Result<std::shared_ptr<StructScalar>> FunctionOptionsToStructScalar(
+    const FunctionOptions&);
+ARROW_EXPORT
+Result<std::unique_ptr<FunctionOptions>> FunctionOptionsFromStructScalar(
+    const StructScalar&);
+
+template <typename T>
+struct PropertyToString {
+  static std::string ToString(const T& value) {
+    std::stringstream ss;
+    ss << value;
+    return ss.str();
+  }
+};
+template <>
+struct PropertyToString<bool> {
+  static std::string ToString(bool value) { return value ? "true" : "false"; }
+};
+template <>
+struct PropertyToString<std::string> {
+  static std::string ToString(const std::string& value) {
+    std::stringstream ss;
+    ss << '"' << value << '"';
+    return ss.str();
+  }
+};
+template <typename T>
+struct PropertyToString<std::shared_ptr<T>> {
+  static std::string ToString(const std::shared_ptr<T>& value) {
+    std::stringstream ss;
+    return value ? value->ToString() : "<NULLPTR>";
+  }
+};
+template <>
+struct PropertyToString<std::shared_ptr<Scalar>> {
+  static std::string ToString(const std::shared_ptr<Scalar>& value) {
+    std::stringstream ss;
+    ss << value->type->ToString() << ":" << value->ToString();
+    return ss.str();
+  }
+};
+template <>
+struct PropertyToString<std::shared_ptr<const KeyValueMetadata>> {
+  static std::string ToString(const std::shared_ptr<const KeyValueMetadata>& 
value) {
+    std::stringstream ss;
+    ss << "KeyValueMetadata{";
+    if (value) {
+      bool first = true;
+      for (const auto& pair : value->sorted_pairs()) {
+        if (!first) ss << ", ";
+        first = false;
+        ss << pair.first << ':' << pair.second;
+      }
+    }
+    ss << '}';
+    return ss.str();
+  }
+};
+template <>
+struct PropertyToString<Datum> {
+  static std::string ToString(const Datum& value) {
+    switch (value.kind()) {
+      case Datum::NONE:
+        return "<NULL DATUM>";
+      case Datum::SCALAR:
+        return 
PropertyToString<std::shared_ptr<Scalar>>::ToString(value.scalar());
+      case Datum::ARRAY: {
+        std::stringstream ss;
+        ss << value.type()->ToString() << ':' << 
value.make_array()->ToString();
+        return ss.str();
+      }
+      case Datum::CHUNKED_ARRAY:
+      case Datum::RECORD_BATCH:
+      case Datum::TABLE:
+      case Datum::COLLECTION:
+        return value.ToString();
+    }
+    return value.ToString();
+  }
+};
+template <typename T>
+struct PropertyToString<std::vector<T>> {
+  static std::string ToString(const std::vector<T>& value) {
+    std::stringstream ss;
+    ss << "[";
+    bool first = true;
+    // Don't use range-for with auto& to avoid Clang -Wrange-loop-analysis

Review comment:
       Clang complains when that gets instantiated with `std::vector<bool>` 
because, well vector<bool> is special :upside_down_face:  

##########
File path: cpp/src/arrow/compute/util_internal.h
##########
@@ -17,6 +17,9 @@
 
 #pragma once
 
+#include <iosfwd>
+#include <vector>
+

Review comment:
       Sorry, these were left over from a change I didn't back out fully




-- 
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