Conversation
| @@ -338,46 +338,6 @@ def select(self, query: Select) -> pd.DataFrame: | |||
|
|
|||
Contributor
There was a problem hiding this comment.
Correctness: In APIResource.select, removing the logic that handles use_query_df and project_dataframe breaks support for aggregations (COUNT, SUM), GROUP BY, ORDER BY, and computed columns. Since filter_dataframe only performs a SELECT * on the fetched data, the final result will contain raw rows instead of the projected or aggregated values defined in the query. This logic must be restored to maintain SQL contract correctness.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In `mindsdb/integrations/libs/api_handler.py` around the block after `result = filter_dataframe(...)`, restore the removed projection/aggregation logic. Reintroduce the `has_complex_targets`/`use_query_df` decision and call `query_df` for aggregations, GROUP BY, ORDER BY, or complex targets; otherwise use `project_dataframe`. Ensure WHERE and LIMIT handling matches the previous behavior so filters aren’t applied twice.
Collaborator
Author
There was a problem hiding this comment.
such conditions handled later in SubSelect step
ea-rus
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In this PR, fixes were made for the correct handling of requests to the API handler of varying complexity: simple queries, queries with functions, queries with aggregate functions, with ORDER/GROUP BY, with LIMIT.
Fixes #FQE-2044
Type of change
(Please delete options that are not relevant)
Verification Process
To ensure the changes are working as expected:
Additional Media:
Checklist: