Mryange opened a new pull request, #68308:
URL: https://github.com/apache/doris/pull/68308
Logical OR used bitwise OR on the nested bytes of Boolean columns. Nullable
rows may carry arbitrary nested payloads, so `NULL OR TRUE` could expose a
non-canonical non-NULL Boolean byte instead of `1`. Downstream expressions such
as multi-branch `CASE WHEN` could then use that byte as an invalid branch index
and crash the BE.
Root cause: both the generic logical function and the `VCompoundPred` fast
path preserved input bits instead of producing a canonical Boolean result. This
change normalizes every logical OR result to `0` or `1` while preserving SQL
three-valued NULL semantics. It also adds focused BE coverage and SQL
regressions for nullable payloads, `CASE WHEN`, short-circuit evaluation
settings, and the complete `TRUE`/`FALSE`/`NULL` OR truth table.
The resulting nullable Boolean representation follows this truth table.
`NULL(any)` means that the nested byte of a NULL row may contain any value; it
is ignored whenever `res_null` is `1`.
| Left | Right | `res_null` | `res_data` | Final result |
|---|---|---:|---:|---|
| `FALSE` | `FALSE` | 0 | 0 | `FALSE` |
| `FALSE` | `TRUE` | 0 | 1 | `TRUE` |
| `TRUE` | `FALSE` | 0 | 1 | `TRUE` |
| `TRUE` | `TRUE` | 0 | 1 | `TRUE` |
| `NULL(any)` | `FALSE` | 1 | 0 or 1 | `NULL` |
| `FALSE` | `NULL(any)` | 1 | 0 or 1 | `NULL` |
| `NULL(any)` | `TRUE` | 0 | 1 | `TRUE` |
| `TRUE` | `NULL(any)` | 0 | 1 | `TRUE` |
| `NULL(any)` | `NULL(any)` | 1 | 0 or 1 | `NULL` |
### 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]