Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add support for enabling ORDER BY on non projected columns #1155

Merged
merged 4 commits into from
Sep 19, 2023

Conversation

gaurav274
Copy link
Member

@gaurav274 gaurav274 commented Sep 17, 2023

In response to PR #1147, we've introduced support for the use of ORDER BY on non-projected columns

SELECT name FROM meme_images
ORDER BY Similarity(SiftFeatureExtractor(Open("{}")), SiftFeatureExtractor(data))
LIMIT 1;

SELECT FaceDetector(data) FROM MyVideo WHERE id < 5 order by scores;

SELECT AirForecast(12) order by y;

Select name FROM meme_images ORDER BY name;

The following query won't work.

Select name AS n FROM meme_images ORDER BY n;

Currently, we execute projection as the last operation. Only when a function expression is present it is executed before projection, allowing its use in ORDER BY. A complete fix will require us to redesign the binder. Right now, we've decided to defer this task because there is no urgency to support it.

Ref: https://github.com/duckdb/duckdb/blob/52a47a6b311a8aa008e7c78d8472eb52a937fa62/src/planner/expression_binder/order_binder.cpp#L68

@gaurav274 gaurav274 self-assigned this Sep 17, 2023
@gaurav274 gaurav274 added this to the v0.3.5 milestone Sep 17, 2023
@xzdandy xzdandy added Feature Request ✨ New feature or request Work In Progress 🚧 High Effort 🏋 Difficult solution or problem to solve labels Sep 18, 2023
@gaurav274 gaurav274 requested a review from xzdandy September 19, 2023 07:35
Copy link
Collaborator

@xzdandy xzdandy left a comment

Choose a reason for hiding this comment

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

Have you tried running long integration tests to verify the fix?

@gaurav274 gaurav274 merged commit 5dc2282 into staging Sep 19, 2023
@gaurav274 gaurav274 deleted the fix-bug branch September 19, 2023 15:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Feature Request ✨ New feature or request High Effort 🏋 Difficult solution or problem to solve
Projects
Development

Successfully merging this pull request may close these issues.

2 participants