pitrou commented on issue #47112:
URL: https://github.com/apache/arrow/issues/47112#issuecomment-3201273738

   (sorry for the delay, I was on vacation!)
   
   > With an event driven API, callers would pull either type of run, but would 
need some bookkeeping to manage cases where the `n_values` they are asked to 
pull will fall in the middle of a run. This logic need to be repeated for each 
caller.
   
   That, or the event driven API itself has a top-level Parse method that takes 
a `n_values`, such that the parser does the bookkeeping by itself.
   
   Something like:
   ```c++
   struct RepeatedRun {
     uint32_t value;
     int32_t num_values; 
   };
   
   struct LiteralRun {
     const uint8_t* data;
     int32_t num_values;
   };
   
   class RleBitPackedParser {
    public:
      // Snip constructor, etc.
   
      template <typename Handler>
      void ParseValues(int n_values, Handler&& handler);
   };
   
   // API expected of a handler
   struct Handler {
     void OnRepeatedRun(RepeatedRun run);
     void OnLiteralRun(LiteralRun run);
     void OnEnd();
   };
   ```
   


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