kou commented on code in PR #45094:
URL: https://github.com/apache/arrow/pull/45094#discussion_r1894566543


##########
cpp/src/arrow/array/statistics.h:
##########
@@ -34,22 +34,38 @@ namespace arrow {
 /// as Apache Parquet may have statistics. Statistics associated with
 /// data source can be read unified API via this class.
 struct ARROW_EXPORT ArrayStatistics {
+  /// \brief The type for maximum and minimum values. If the target
+  /// value exists, one of them is used. `std::nullopt` is used
+  /// otherwise.
   using ValueType = std::variant<bool, int64_t, uint64_t, double, std::string>;
 
   static const std::shared_ptr<DataType>& ValueToArrowType(
-      const std::optional<ValueType>& value) {
+      const std::optional<ValueType>& value,
+      const std::shared_ptr<DataType>& array_type) {
     if (!value.has_value()) {
       return null();
     }
 
     struct Visitor {
+      const std::shared_ptr<DataType>& array_type;
+
       const std::shared_ptr<DataType>& operator()(const bool&) { return 
boolean(); }
       const std::shared_ptr<DataType>& operator()(const int64_t&) { return 
int64(); }
       const std::shared_ptr<DataType>& operator()(const uint64_t&) { return 
uint64(); }
       const std::shared_ptr<DataType>& operator()(const double&) { return 
float64(); }
-      // GH-44579: How to support binary data?
-      const std::shared_ptr<DataType>& operator()(const std::string&) { return 
utf8(); }
-    } visitor;
+      const std::shared_ptr<DataType>& operator()(const std::string&) {
+        switch (array_type->id()) {
+          case Type::STRING:
+          case Type::BINARY:
+          case Type::FIXED_SIZE_BINARY:

Review Comment:
   Should we use `arrow::binary()` or `arrow::large_binary()` for 
`Type::FIXED_SIZE_BINARY`?
   Approximate min/max values may not be a fixed size binary...?



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