wgtmac commented on code in PR #45258:
URL: https://github.com/apache/arrow/pull/45258#discussion_r1916200183


##########
cpp/src/parquet/statistics.cc:
##########
@@ -407,8 +407,18 @@ optional<std::pair<FLBA, FLBA>> 
CleanStatistic(std::pair<FLBA, FLBA> min_max,
 
 optional<std::pair<ByteArray, ByteArray>> CleanStatistic(
     std::pair<ByteArray, ByteArray> min_max, LogicalType::Type::type) {
-  if (min_max.first.ptr == nullptr || min_max.second.ptr == nullptr) {
-    return ::std::nullopt;
+  static ByteArray empty("");
+  if (min_max.first.ptr == nullptr) {
+    if (min_max.first.len != 0) {
+      return ::std::nullopt;
+    }
+    min_max.first = empty;

Review Comment:
   I guess the root cause is here: 
https://github.com/apache/arrow/blob/3b932bb275c6e7e072f156cd6efe9ed2ec7d30cf/cpp/src/parquet/statistics.cc#L609-L615
   
   When both `min_value` and `max_value` exist but at least one of them is an 
empty string, `min_` or `max_` is not initialized.
   
   Should we fix here instead of CleanStatistics above?



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