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

Fix unparser derived table with columns include calculations, limit/order/distinct #24

Merged

Conversation

y-f-u
Copy link

@y-f-u y-f-u commented Jul 29, 2024

fix queries that wasn't working.

SELECT id FROM (SELECT j1_id + 1 * 3 from j1) AS c (id)
fix: compare using format!("{expr}") == format!("{outer_expr}") which is a wider rule than `expr == outer_expr. It covers the situation when there are mismatch expr types caused when sql -> logical plan that outer projection has column expr and inner projection has a calculation expr.

SELECT c.id FROM (SELECT (j1.j1_id + 1) FROM j1 ORDER BY j1.j1_id DESC NULLS FIRST LIMIT 1) AS c (id)
fix: the same fix from above for sort column j1.j1_id not in projection list j1.j1_id + 1 and projections have mismatch expr types.
another fix: use a recursive method to find the inner projection which may hide under limit/order/distinct that prevents subquery_alias_inner_query_and_columns to work

@y-f-u y-f-u merged commit 1c65aff into spiceai-40 Jul 29, 2024
@y-f-u y-f-u deleted the fix-unparser-derived-table-with-columns-include-calculations branch July 29, 2024 05:54
y-f-u added a commit that referenced this pull request Jul 31, 2024
…rder/distinct (#24)

* compare format output to make sure the two level of projects match

* add method to find inner projection that could be nested under limit/order/distinct

* use format! for matching in unparser sort optimization too

* refactor

* use to_string and also put comments in
phillipleblanc pushed a commit that referenced this pull request Aug 14, 2024
…calculations, limit/order/distinct (apache#11756)

* Fix unparser derived table with columns include calculations, limit/order/distinct (#24)

* compare format output to make sure the two level of projects match

* add method to find inner projection that could be nested under limit/order/distinct

* use format! for matching in unparser sort optimization too

* refactor

* use to_string and also put comments in

* clippy

* fix unparser derived table contains cast (#25)

* fix unparser derived table contains cast

* remove dbg
sgrebnov pushed a commit that referenced this pull request Sep 2, 2024
…calculations, limit/order/distinct (apache#11756)

* Fix unparser derived table with columns include calculations, limit/order/distinct (#24)

* compare format output to make sure the two level of projects match

* add method to find inner projection that could be nested under limit/order/distinct

* use format! for matching in unparser sort optimization too

* refactor

* use to_string and also put comments in

* clippy

* fix unparser derived table contains cast (#25)

* fix unparser derived table contains cast

* remove dbg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants