Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ORDER BY does not work on non projected columns #1147

Closed
2 tasks done
gaurav274 opened this issue Sep 17, 2023 · 0 comments
Closed
2 tasks done

ORDER BY does not work on non projected columns #1147

gaurav274 opened this issue Sep 17, 2023 · 0 comments
Assignees
Labels
Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing High Effort 🏋 Difficult solution or problem to solve
Milestone

Comments

@gaurav274
Copy link
Member

Search before asking

  • I have searched the EvaDB issues and found no similar bug report.

Bug

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

The data column is accessible in the order by executor.

Cause: Breaking PR - #1136

Environment

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@gaurav274 gaurav274 self-assigned this Sep 17, 2023
@gaurav274 gaurav274 added Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing labels Sep 17, 2023
@gaurav274 gaurav274 added this to the v0.3.5 milestone Sep 17, 2023
@gaurav274 gaurav274 added the High Effort 🏋 Difficult solution or problem to solve label Sep 17, 2023
gaurav274 added a commit that referenced this issue Sep 19, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing High Effort 🏋 Difficult solution or problem to solve
Projects
Archived in project
Development

No branches or pull requests

1 participant