Mryange opened a new pull request, #64748:
URL: https://github.com/apache/doris/pull/64748
### What problem does this PR solve?
Problem Summary:
Doris converts Arrow arrays from several external read paths into Doris
columns through `DataTypeSerDe::read_column_from_arrow`. If an upstream Arrow
array has invalid internal metadata, such as invalid string offsets, the
current conversion code can enter the serde implementation directly and only
fail later in a less controlled way.
Root cause: `read_column_from_arrow` was a public virtual entry point and
external callers invoked it directly. There was no common boundary where Doris
validated the Arrow array before entering the type-specific serde code.
This PR adds `DataTypeSerDeArrowUtils::read_column_from_arrow` as the public
Arrow-read entry. External Arrow conversion callers now go through this
utility. The utility always runs lightweight Arrow `Validate()` before
conversion. The original virtual `DataTypeSerDe::read_column_from_arrow` is
kept private so nested serde recursion can continue to use the original
implementation without repeatedly validating every nested child array.
`ValidateFull()` is available through the BE config
`enable_arrow_read_validate_full`, defaulting to `false`. It is intentionally
not enabled by default because benchmark results show that full validation is
much more expensive on string and nested string arrays, while lightweight
`Validate()` is effectively negligible.
Benchmark results, 65536 rows, mean real time:
| Case | Validate only | Read only | Validate + read | ValidateFull + read |
ValidateFull overhead |
| --- | ---: | ---: | ---: | ---: | ---: |
| Int32 | 0.025 us | 8.02 us | 8.09 us | 7.99 us | -0.4% |
| String len 8 | 0.031 us | 564 us | 572 us | 809 us | +43.4% |
| String len 128 | 0.031 us | 3241 us | 3108 us | 3770 us | +16.3% |
| Nullable String len 8 | 0.032 us | 595 us | 600 us | 859 us | +44.4% |
| Nullable String len 128 | 0.031 us | 2895 us | 2955 us | 4260 us | +47.2% |
| `Array<String len 8>` | 0.059 us | 4158 us | 4233 us | 5836 us | +40.4% |
| `Array<String len 128>` | 0.058 us | 17826 us | 18340 us | 21896 us |
+22.8% |
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]