ByteBaker commented on issue #6553:
URL: https://github.com/apache/arrow-rs/issues/6553#issuecomment-2409051978

   @alamb this is the basic idea I have. Lemme know if I should change this.
   
   ```rust
   let schema: Arc<Schema> = ...;
   let options: RecordBatchOptions = ...;
   let array: Arc<Int32Array> = ...; // Can have more arrays
   
   record_batch!(schema); // Creates empty RecordBatch
   record_batch!(schema, [array]); // Returns a result
   record_batch!(schema, [array], options); // Creates w/ options, returns a 
result
   ```
   
   Or do we want something that allows us to write a template-like, visually 
intuitive structure for creating an RB? For instance:
   
   ```rust
   record_batch!{
       // Always required
       [
        "id", Int32, false // More fields can go in next lines
       ],
       // Following bit be optional. 
       // Not giving data would create an empty RecordBatch
       [
        Int32Array[1, 2, 3, 4, 5] // More arrays can go in next lines
       ],
       // `RecordBatchOptions` with `match_field_names` = false & `row_count` = 
Some(10)
       // This bit is optional, and the absence will just use the default 
options
       {true, 10}
   
   }
   ```
   
   Also, how do we reconcile the return types in this case?
   - Using just `Schema` would create a `RecordBatch` directly
   - Any other combination would return `Result<RecordBatch>`


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