mapleFU commented on PR #14341:
URL: https://github.com/apache/arrow/pull/14341#issuecomment-1480564576

   Personally, I think we can make it easier, like using 
`PutImpl(std::vector<ByteArray>, int num_values)`. When Put with arrow, we can 
extract it into it.
   
   Or we can:
   
   ```C++
   template <typename ParquetT>
   struct ParquetIndirectType {
     static const uint8_t* getPtr(ParquetT object) noexcept;
     static int getLen(const parquet::ColumnDescriptor* descr, ParquetT object) 
noexcept;
   };
   
   template <>
   struct ParquetIndirectType<parquet::ByteArray> {
     static const uint8_t* getPtr(parquet::ByteArray object) noexcept {
       return object.ptr;
     }
   
     static int getLen([[maybe_unused]] const parquet::ColumnDescriptor* descr, 
parquet::ByteArray object) noexcept {
       return object.len;
     }
   };
   
   template <>
   struct ParquetIndirectType<parquet::FixedLenByteArray> {
     static const uint8_t* getPtr(parquet::FixedLenByteArray object) noexcept {
       return object.ptr;
     }
   
     static int getLen(
         const parquet::ColumnDescriptor* descr, [[maybe_unused]] 
parquet::FixedLenByteArray object) noexcept {
       return descr->type_length();
     }
   };
   ```
   
   And use template to just write one part of the code. But it may have worse 
performance than your impl if compiler doesn't work well. The current skeleton 
is ok to me


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