You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/07/07 13:58:29 UTC

[GitHub] [arrow] mapleFU opened a new issue, #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

mapleFU opened a new issue, #36548:
URL: https://github.com/apache/arrow/issues/36548

   ### Describe the enhancement requested
   
   When I go through the code in `Statistics` and `PageIndex`, I found the argument of builder contains a `::arrow::MemoryPool`, and most caller didn't passing it. Like:
   
   Builder: 
   
   ```C++
   /// \brief Typed version of Statistics::Make
   template <typename DType>
   std::shared_ptr<TypedStatistics<DType>> MakeStatistics(
       const ColumnDescriptor* descr,
       ::arrow::MemoryPool* pool = ::arrow::default_memory_pool()) {
     return std::static_pointer_cast<TypedStatistics<DType>>(Statistics::Make(descr, pool));
   }
   ```
   
   Caller:
   
   ```c++
   template <typename DType>
   static std::shared_ptr<Statistics> MakeTypedColumnStats(
       const format::ColumnMetaData& metadata, const ColumnDescriptor* descr) {
     // If ColumnOrder is defined, return max_value and min_value
     if (descr->column_order().get_order() == ColumnOrder::TYPE_DEFINED_ORDER) {
       return MakeStatistics<DType>(
           descr, metadata.statistics.min_value, metadata.statistics.max_value,
           metadata.num_values - metadata.statistics.null_count,
           metadata.statistics.null_count, metadata.statistics.distinct_count,
           metadata.statistics.__isset.max_value || metadata.statistics.__isset.min_value,
           metadata.statistics.__isset.null_count,
           metadata.statistics.__isset.distinct_count);
     }
     // Default behavior
     return MakeStatistics<DType>(
         descr, metadata.statistics.min, metadata.statistics.max,
         metadata.num_values - metadata.statistics.null_count,
         metadata.statistics.null_count, metadata.statistics.distinct_count,
         metadata.statistics.__isset.max || metadata.statistics.__isset.min,
         metadata.statistics.__isset.null_count, metadata.statistics.__isset.distinct_count);
   }
   ```
   
   However, I found that `::arrow::MemoryPool` is not useful here, it's used to build the `PlainEncoder` and Encode the min-max, and only used with little time and building small chunk of memory, so, do we need passing `MemoryPool` to `Statistics`? Or just using default one is ok?
   
   ### Component(s)
   
   C++, Parquet


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] wgtmac commented on issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on issue #36548:
URL: https://github.com/apache/arrow/issues/36548#issuecomment-1625562741

   You are right, memory pool is only used to allocate (temporary) buffer for encoding min/max values. In the page index, all min/max values are stored in the thrift ColumnIndex objects which we cannot control.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex? [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU closed issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?
URL: https://github.com/apache/arrow/issues/36548


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] mapleFU commented on issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #36548:
URL: https://github.com/apache/arrow/issues/36548#issuecomment-1625459167

   cc @pitrou @wgtmac @felipecrv 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] mapleFU commented on issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on issue #36548:
URL: https://github.com/apache/arrow/issues/36548#issuecomment-1626640744

   Well, I mean that most of time using default is enough here, because it only allocates little memory(If encoded content is not too large)


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] felipecrv commented on issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on issue #36548:
URL: https://github.com/apache/arrow/issues/36548#issuecomment-1625782269

   Pass it to the small allocations now and later, when those other functions learn to take a MemoryPool, we can pass it to them as well.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] pitrou commented on issue #36548: [C++][Parquet] Do we need `MemoryPool` in Statistics and PageIndex?

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #36548:
URL: https://github.com/apache/arrow/issues/36548#issuecomment-1625598512

   Well, we should make sure we propagate the MemoryPool instead of removing that argument.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org