Skip to content

branch-4.1: [fix](scan) Avoid misleading "storage reader" wrapper for data/expression errors #64755 - #64840

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64755-branch-4.1
Jun 26, 2026
Merged

branch-4.1: [fix](scan) Avoid misleading "storage reader" wrapper for data/expression errors #64755#64840
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64755-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #64755

…sion errors (#64755)
## Proposed changes
### Problem
When an `INSERT`/`CTAS` (or any query) hits a data-conversion error
during scan — e.g. a strict `CAST(... AS BIGINT)` on an empty string
produced by `regexp_extract`, which returns `INVALID_ARGUMENT parse
number fail, string: ''` — the user-facing error reads:
```
[INVALID_ARGUMENT]parse number fail, string: ''failed to initialize storage reader. tablet=421411554, backend=10.228.1.18
```
The `failed to initialize storage reader. tablet=...` suffix makes it
look like the tablet/segment is corrupted or missing, when the real
cause is a data/expression error.
### Root cause
`OlapScanner::_open_impl` appended `failed to initialize storage reader.
tablet=...` to **any** non-OK status returned by `TabletReader::init()`.
But `init()` does not merely set up objects — the merge reader eagerly
reads the first block of each rowset (`BlockReader::_init_collect_iter`
→ `VCollectIterator::build_heap` → `Level0Iterator::refresh_current_row`
→ `RowsetReader::next_batch`) to seed the merge heap. Pushed-down
expressions (`common_expr_ctxs`) are evaluated during that first-block
read, so a strict-cast failure surfaces inside `init()` and gets wrapped
with the storage-reader message.
### Fix
Branch on the error code: only genuine storage-level failures keep the
`failed to initialize storage reader` wording. For `INVALID_ARGUMENT`
(data/expression errors) the message stays neutral and explicitly notes
it is a data/expression error rather than a storage failure, while still
reporting tablet/backend for locating the node.
This is purely a message/diagnostics change; control flow and the
returned error code are unchanged. The underlying strict-cast semantics
issue is tracked separately (see #64266).
## Further comments
No behavior change other than the error text; no new tests added.
@github-actions
github-actionsBot requested a review from yiguolei as a code ownerJune 25, 2026 08:06
@yiguolei

Copy link
Copy Markdown
Contributor

run buildall

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Jun 25, 2026
@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by anyone and no changes requested.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/1) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage54.49% (20781/38138)
Line Coverage38.05% (198352/521349)
Region Coverage34.53% (155731/450999)
Branch Coverage35.47% (67858/191311)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage64.19% (23915/37256)
Line Coverage47.72% (247576/518805)
Region Coverage45.16% (205077/454067)
Branch Coverage46.18% (88483/191594)

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@yiguoleiyiguolei reopened this Jun 26, 2026
@yiguolei
yiguolei merged commit 78c8b9b into branch-4.1Jun 26, 2026
43 of 46 checks passed
@morningman
morningman deleted the auto-pick-64755-branch-4.1 branch July 8, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@yiguolei@hello-stephen@liaoxin01