guptashivam04 opened a new pull request, #71385:
URL: https://github.com/apache/doris/pull/71385
### What problem does this PR solve?
Issue Number: None
Related PR: #70849
PR Type: Bug fix
Problem Summary:
Backport of #70849 to branch-4.2. It is the same change with one adaptation:
on branch-4.2 a slot's `column_id()` is its position in the read schema, so the
new code maps it with `_schema->column_id()`, as the rest of
`_calculate_common_expr_index_exec_status` does. Master no longer needs that
mapping. A plain cherry-pick builds, but records the cast on the wrong column,
and `n IN ('0', '1') AND CAST(n AS BOOLEAN)` still returned no rows.
```sql
SELECT count(*) FROM t WHERE s MATCH 'true' AND CAST(s AS BOOLEAN)
```
returned 0 rows with the inverted index on, and the matching rows with it
off. A conjunct that is only a cast of a column was not counted among the
filters on that column, so when the index answered the other filters and the
column was not selected, the column was not read and the cast ran on empty
values. The same happens with SEARCH, MATCH_ANY and IN. Such a conjunct now
counts as one the index does not answer. See #70849.
### Release note
Fix a filter that only casts a column, such as `CAST(s AS BOOLEAN)`,
returning no rows when the inverted index answers another filter on the same
column.
### Check List (For Author)
- Test
- [x] Regression test: `inverted_index_p0/test_index_cast_root_conjunct`
fails on branch-4.2 without this change and passes with it, including the IN
case above.
- [x] `inverted_index_p0` and `search` (296 suites) on a local
branch-4.2 cluster: no suite fails only with this change (the ones that fail,
fail the same way without it, from local setup and leftovers of earlier runs).
- Behavior changed: Yes. Such queries now return the matching rows.
- Does this need documentation: No
--
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]