codeant-ai-for-open-source[bot] commented on code in PR #43148:
URL: https://github.com/apache/superset/pull/43148#discussion_r3799006947
##########
superset/views/datasource/utils.py:
##########
@@ -45,9 +49,11 @@ def get_limit_clause(page: Optional[int], per_page:
Optional[int]) -> dict[str,
if isinstance(page, int) and isinstance(per_page, int):
limit = int(per_page)
- if limit < 0 or limit > samples_row_limit:
+ if limit < 0:
# reset limit value if input is invalid
limit = samples_row_limit
+ elif limit:
+ limit = apply_max_row_limit(limit)
Review Comment:
**Suggestion:** Applying `apply_max_row_limit` before calculating the page
offset changes the effective page size, but `get_samples` still reports the
original `per_page`. When `SQL_MAX_ROW` is lower than the requested value, page
2 is therefore offset by the capped size while the API advertises the uncapped
size, causing pages to overlap or return unexpected ranges. Calculate
pagination consistently using the effective limit, and expose that effective
limit to callers, or reject/report the capped request. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Samples pagination reports requested rather than effective page size.
- ⚠️ Deployments with low `SQL_MAX_ROW` show unexpected page ranges.
- ⚠️ Explore Samples clients cannot reliably interpret pagination metadata.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=11ae993abd574b48af27c64919572ce6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=11ae993abd574b48af27c64919572ce6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/datasource/utils.py
**Line:** 55:56
**Comment:**
*Api Mismatch: Applying `apply_max_row_limit` before calculating the
page offset changes the effective page size, but `get_samples` still reports
the original `per_page`. When `SQL_MAX_ROW` is lower than the requested value,
page 2 is therefore offset by the capped size while the API advertises the
uncapped size, causing pages to overlap or return unexpected ranges. Calculate
pagination consistently using the effective limit, and expose that effective
limit to callers, or reject/report the capped request.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43148&comment_hash=8aee1c3e86743528f296411eb3eda2d39063c8143533e4eff037bb1190360cd5&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43148&comment_hash=8aee1c3e86743528f296411eb3eda2d39063c8143533e4eff037bb1190360cd5&reaction=dislike'>👎</a>
--
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]