ChaomingZhangCN opened a new pull request, #281:
URL: https://github.com/apache/paimon-cpp/pull/281

   ### Purpose
   
   Linked issue: N/A
   
   `FieldListaggAgg` returned a `std::string_view` backed by a mutable member 
string shared by all calls to the same aggregator instance.
   
   The merge path reuses one field aggregator across primary keys, while 
`SortMergeReaderBatchProducer` may retain results for multiple keys before 
converting the batch to Arrow. As a result, aggregating a later key could 
overwrite or invalidate the string data referenced by an earlier key, causing 
cross-key data corruption.
   
   This change:
   
   - builds each concatenated result independently;
   - stores the result in a pool-backed `BinaryString`;
   - removes the shared mutable result buffer;
   - preserves the lifetime of previously returned aggregation results.
   
   ### Tests
   
   Added `FieldListaggAggTest.TestResultOwnershipAcrossAggregations`.
   
   The regression test retains the result of one aggregation, performs another 
independent aggregation using the same aggregator, and then verifies that both 
results remain unchanged.
   
   Before the fix, the test fails deterministically:
   
   ```text
   Expected: alpha,beta
   Actual:   one,two\0\0\0
   ```
   
   After the fix:
   
   - `FieldListaggAggTest.*`: 14 tests passed
   - `cmake --build build-pk-vector-release --target paimon_shared -j 8`
   - clang-format, codespell, cpplint, trailing-whitespace, and end-of-file 
checks passed
   - `git diff --check` passed
   
   The monolithic `paimon-core-test` target compiles the affected source and 
test objects but cannot be linked locally on macOS arm64 because of an existing 
unrelated undefined symbol:
   
   ```text
   paimon::Literal::Literal<long>(long const&)
   ```
   
   ### API and Format
   
   No public API, storage format, or protocol changes.
   
   ### Documentation
   
   No documentation changes are required.
   
   ### Generative AI tooling
   
   Generated-by: OpenAI Codex (GPT-5)


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