Skip to content

Fix API handlers#12200

Merged
StpMax merged 3 commits intoreleases/26.0.0from
fix/FQE-2044-2
Feb 6, 2026
Merged

Fix API handlers#12200
StpMax merged 3 commits intoreleases/26.0.0from
fix/FQE-2044-2

Conversation

@StpMax
Copy link
Collaborator

@StpMax StpMax commented Feb 5, 2026

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)

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ⚡ New feature (non-breaking change which adds functionality)
  • 📢 Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • 📄 This change requires a documentation update

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Additional Media:

  • I have attached a brief loom video or screenshots showcasing the new functionality or change.

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

@@ -338,46 +338,6 @@ def select(self, query: Select) -> pd.DataFrame:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such conditions handled later in SubSelect step

@StpMax StpMax merged commit cc4f631 into releases/26.0.0 Feb 6, 2026
29 of 33 checks passed
@StpMax StpMax deleted the fix/FQE-2044-2 branch February 6, 2026 13:20
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants