arouel opened a new pull request, #3498:
URL: https://github.com/apache/parquet-java/pull/3498

   ### Rationale for this change
   
   `DefaultValuesWriterFactory` delegates to static singleton instances of 
`DefaultV1ValuesWriterFactory` and `DefaultV2ValuesWriterFactory`. These 
singletons store a mutable `parquetProperties` reference via `initialize()`, 
which gets overwritten by whichever `ParquetProperties` instance calls it last. 
When multiple Parquet writers run concurrently in the same JVM, the merger's 
column writers end up using the appender's `ByteBufferAllocator`. When the 
appender is closed and its allocator released, the merger crashes with 
`IllegalStateException: Already closed` on direct ByteBuffer access because its 
encoder slabs were allocated from a now-closed arena.
   
   ### What changes are included in this PR?
   
   Replace the static final `DEFAULT_V1_WRITER_FACTORY` and 
`DEFAULT_V2_WRITER_FACTORY` singletons in `DefaultValuesWriterFactory` with 
fresh instances created per `initialize()` call. This ensures each 
`ParquetProperties` instance (and its allocator) is isolated to its own 
factory, eliminating cross-contamination between concurrent writers sharing the 
same JVM.
   
   ### Are these changes tested?
   
   Yes, locally
   
   ### Are there any user-facing changes?
   
   No.
   
   Closes #3497
   


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