linrrzqqq opened a new pull request, #63350:
URL: https://github.com/apache/doris/pull/63350
Problem Summary:
According to Doris doc: `topn count must be a positive integer`, but before
this, negative numbers and 0 were not handled specially, returning `{}`,
leading to unexpected results.
before
```sql
Doris> SELECT TOPN(page_id, -1) as top_zero_pages FROM page_visits;
+----------------+
| top_zero_pages |
+----------------+
| {} |
+----------------+
Doris> SELECT TOPN(page_id, -1) as top_neg_one_pages FROM page_visits;
+-------------------+
| top_neg_one_pages |
+-------------------+
| {} |
+-------------------+
```
now:
```sql
Doris> SELECT TOPN(page_id, 0) as top_pages FROM page_visits;
ERROR 1105 (HY000): errCode = 2, detailMessage = topn requires second
parameter must be a constant positive integer: topn(cast(page_id as
VARCHAR(65533)), 0)
Doris> SELECT TOPN(page_id, -1) as top_pages FROM page_visits;
ERROR 1105 (HY000): errCode = 2, detailMessage = topn requires second
parameter must be a constant positive integer: topn(cast(page_id as
VARCHAR(65533)), -1)
```
--
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]