freemandealer opened a new pull request, #70872:
URL: https://github.com/apache/doris/pull/70872

   ### Background
   
   `SHOW EXPORT` lists the files an `EXPORT` job creates in the `OutfileInfo` 
column. Each backend writer reports its own file count and URL, and parallel 
writers can share a result buffer. [SHOW EXPORT 
reference](https://doris.apache.org/docs/dev/sql-manual/sql-statements/data-modification/load-and-export/SHOW-EXPORT/)
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #48022 (introduced `ExportTaskExecutor` metadata extraction)
   PR Type: Bugfix
   
   Problem Summary:
   
   A writer that created one file returned a wildcard such as 
`part_<fragment>_*`. Consumers had to reconstruct the suffix and padded file 
number to open the object. Parallel exports could also lose a writer's metadata 
when two responses shared a buffer. This change carries the name used to create 
each single file through to `SHOW EXPORT`.
   
   ### Details
   
   - **Change map:** 28 production lines changed across writer metadata (16), 
result buffering (7) and FE URL selection (5). The rest covers tests (660 
changed lines) and generated regression output (60 lines).
   - **Frequency:** Always for single-file writers on the previous code path. 
Metadata loss also requires two small responses eligible for merging in the 
same buffer.
   - **Root cause:** `VFileResultWriter` attached only the wildcard `URL`. 
`ResultBlockBuffer` merged the rows of queued MySQL responses without retaining 
both writers' metadata maps.
   - **Why existing tests missed it:** Buffer tests exercised plain rows, 
`ExportOutfileInfoTest` checked JSON serialization, and export regressions 
reconstructed filenames from the wildcard.
   - **Fix:** Save the actual name after successful file creation and attach it 
as `SingleFileURL` when the writer creates one file. Keep MySQL batches with 
metadata separate. The FE prefers the new field when building `OutfileInfo`.
   - **Other paths and branches:** Older BEs and zero- or multi-file writers 
use the wildcard fallback. `SELECT INTO OUTFILE` keeps its six-column result 
and wildcard URL. Arrow keeps its existing merge behavior. The 3.1, 4.0, 4.1 
and 4.2 branches also read only `URL` when assembling `OutfileInfo`.
   - **Behavior change:** Clients can open a single-file URL directly, 
including its compression suffix and configured number padding.
   
   ### Testing
   
   - Built FE and BE locally in ASAN mode with `bash build.sh --be --fe -j 16`. 
FE Checkstyle, clang-format 16, BE header hygiene and clang-tidy on the changed 
C++ code passed.
   - `run-be-ut.sh` passed all 15 tests in `VFileResultWriterTest`, 
`MysqlResultBlockBufferTest` and `ArrowResultBlockBufferTest`. `run-fe-ut.sh` 
passed both tests in `ExportOutfileInfoTest`, including the old-BE fallback.
   - Ran `run-regression-test.sh --run -d export_p0 -s 
test_export_single_file_url` against a local S3-compatible store. All ten 
format and compression combinations returned one exact URL and read back three 
rows through that URL. The suite passed again against its generated 
expectations. Baseline behavior was checked in source.
   
   ### Notes for Reviewers
   
   Three queue and writer tests keep their enqueue and fetch assertions 
together. Their local clang-tidy annotations cover the complexity added by 
GoogleTest macro expansion.
   
   ### Release note
   
   `SHOW EXPORT` now reports the full file URL for each writer that creates one 
file and preserves results from parallel writers. A writer that creates 
multiple files continues to report a wildcard URL.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Partially verified: the provider-specific IAM and 
large-data P2 suites require separate environments.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex (GPT-6)
   - Generated: The port adaptations, additional compatibility tests and this 
description.
   - Human review: Pending.
   


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