andygrove opened a new issue, #1115:
URL: https://github.com/apache/datafusion-comet/issues/1115

   ### What is the problem the feature request solves?
   
   In `CometBatchIterator` we export the schema with each batch via Arrow FFI:
   
   ```scala
             val arrowSchema = ArrowSchema.wrap(schemaAddrs(index))
             val arrowArray = ArrowArray.wrap(arrayAddrs(index))
             Data.exportVector(
               allocator,
               getFieldVector(valueVector, "export"),
               provider,
               arrowArray,
               arrowSchema)
   ```
   
   Exporting the schema seems quite expensive since it involves string copies 
and memory allocation. It gets more expensive for complex schemas, especially 
when nested types are involved.
   
   Internally in `Data.exportVector`, the schema is exported with:
   
   ```
   exportField(allocator, vector.getField(), provider, outSchema);
   ```
   
   I wonder if we could refactor `CometBatchIterator` to just export the schema 
once, with the first batch, and then have the native side re-use that schema 
for subsequent batches.
   
   ### Describe the potential solution
   
   _No response_
   
   ### Additional context
   
   _No response_


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to