You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/03/23 03:55:15 UTC

[GitHub] [arrow] mapleFU commented on pull request #14341: GH-32863: [C++][Parquet] Add DELTA_BYTE_ARRAY encoder to Parquet writer

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

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