andygrove opened a new pull request, #3213:
URL: https://github.com/apache/datafusion-comet/pull/3213

   ## Summary
   
   **This is a work-in-progress PR - not ready for review yet.**
   
   This PR optimizes `CometColumnarToRowExec` for complex types (arrays and 
maps) by:
   
   ### Phase 1: Cache offset buffer addresses in Comet vectors
   - `CometListVector` and `CometMapVector` now cache the offset buffer memory 
address at construction time
   - `getArray()`/`getMap()` use `Platform.getInt()` for direct memory access 
instead of `getOffsetBuffer().getInt()`
   - This eliminates 2 virtual method calls per offset read (4 total per 
`getArray()`/`getMap()` call)
   
   ### Phase 2: Custom code generation for complex types
   - `CometColumnarToRowExec` now generates optimized code for `ArrayType` and 
`MapType` columns
   - Per-batch caching of offset buffer addresses and child vectors in 
generated code
   - Uses `Platform.getInt()` directly in generated code for offset access
   
   ### Before (per row):
   ```java
   listVector.getOffsetBuffer().getInt(i * OFFSET_WIDTH)  // 2 virtual calls + 
bounds check
   ```
   
   ### After (per row):
   ```java
   Platform.getInt(null, offsetBufferAddress + (long) i * OFFSET_WIDTH)  // JIT 
intrinsified
   ```
   
   ## TODO
   - [ ] Phase 3: Reusable wrapper objects (MutableColumnarArray/Map) to 
eliminate object allocation
   - [ ] Benchmarking to measure performance improvements
   - [ ] Additional test coverage
   - [ ] Handle StructType similarly
   
   ## Test plan
   - [x] `CometArrayExpressionSuite` passes (32 tests)
   - [x] `CometMapExpressionSuite` passes (2 tests, 2 canceled, 1 ignored)
   - [ ] Full test suite
   - [ ] Performance benchmarks
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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