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

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   `StreamingInsertJob.beforeCommitted` wrote `loadStatistic.getFileNumber()` 
into the txn commit attachment. That field is populated by 
`InsertIntoTableCommand.applyInsertPlanStatistic` from 
`FileScanNode.getSelectedSplitNum()`, so it holds the BE **split count**, not 
the number of physical input files.
   
   When a CSV crossed the split-size threshold (default 
`max_initial_file_split_size × 1.1 ≈ 35.2MB`) and was cut into multiple splits, 
`jobs("type"="insert").LoadStatistic.FileNumber` reported a value larger than 
the actual file list. In the real user scenario, 8 input files appeared as 
`FileNumber = 16` because each 42MB file was split in two. Data correctness is 
unaffected; only the displayed statistic was misleading.
   
   Fix:
   - Add `Offset.getPhysicalFileNum()` as a `default` returning `-1` (source 
doesn't expose a physical count).
   - Override it in `S3Offset` to return `fileNum`, which is set by 
`S3SourceOffsetProvider.getNextOffset()` to `rfiles.size()` — the actual S3 
list result used to rewrite the TVF `uri`.
   - In `StreamingInsertJob.beforeCommitted`, prefer the offset's physical file 
count when available; fall back to `loadStatistic.getFileNumber()` for sources 
that don't expose it (e.g. JDBC) so their behavior is unchanged.
   
   `EXPLAIN`'s `inputSplitNum` still reports the split count; the two fields 
are now semantically distinct.
   
   Compatibility note: the proto field 
`StreamingTaskCommitAttachmentPB.num_files` type is unchanged, but its 
semantics for S3 streaming change from split count to physical file count. 
Attachments produced by an older FE and consumed after upgrade will temporarily 
mix split and file counts until new attachments replace them.
   
   ### Release note
   
   Fix `jobs("type"="insert").LoadStatistic.FileNumber` for S3 streaming insert 
jobs to report the physical file count rather than the BE split count.
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. `LoadStatistic.FileNumber` for S3 streaming insert jobs now 
reflects the number of physical input files instead of the BE split count. 
Other source types (e.g. JDBC) are unchanged.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


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