Mryange opened a new pull request, #33934:
URL: https://github.com/apache/doris/pull/33934
## Proposed changes
Correct SQL
```
mysql [tpch_sf100]>select count(1) from lineitem, tmp where l_orderkey >
(tmp.id + tmp.id);
+-----------+
| count(1) |
+-----------+
| 600037884 |
+-----------+
```
Incorrect SQL
```
mysql [tpch_sf100]>select count(1) from lineitem, (select id + id as x from
tmp) t where l_orderkey > x;
+-----------+
| count(1) |
+-----------+
| 512150170 |
+-----------+
```
The reason for the error is that we have planned the RF, and we have logic
to ignore expr execution. However, in cases where there is only one column,
_non_predicate_columns will be empty.
Then, in this code...
```cpp
if (!_is_need_vec_eval && !_is_need_short_eval && !_is_need_expr_eval) {
if (_non_predicate_columns.empty()) {
return Status::InternalError("_non_predicate_columns is empty");
}
RETURN_IF_ERROR(_convert_to_expected_type(_first_read_column_ids));
RETURN_IF_ERROR(_convert_to_expected_type(_non_predicate_columns));
_output_non_pred_columns(block);
_output_index_result_column(nullptr, 0, block);
}
```
The previous condition was "_is_need_vec_eval = true," and
_non_predicate_columns was empty.
Later, when _is_need_vec_eval is set to false, it will output an empty block.
<!--Describe your changes.-->
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
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]