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

Sort operator disappear in physical_plan #5100

Closed
xiaoyong-z opened this issue Jan 28, 2023 · 2 comments · Fixed by #5171
Closed

Sort operator disappear in physical_plan #5100

xiaoyong-z opened this issue Jan 28, 2023 · 2 comments · Fixed by #5171
Labels
bug Something isn't working

Comments

@xiaoyong-z
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.
After we disable the repartition ProjectionExec when it does not compute anything, sort operator in subquery went wrong

To Reproduce
Steps to reproduce the behavior:
CREATE EXTERNAL TABLE aggregate_test_100 (
c1 VARCHAR NOT NULL,
c2 TINYINT NOT NULL,
c3 SMALLINT NOT NULL,
c4 SMALLINT,
c5 INT,
c6 BIGINT NOT NULL,
c7 SMALLINT NOT NULL,
c8 INT NOT NULL,
c9 BIGINT UNSIGNED NOT NULL,
c10 VARCHAR NOT NULL,
c11 FLOAT NOT NULL,
c12 DOUBLE NOT NULL,
c13 VARCHAR NOT NULL
)
STORED AS CSV
WITH HEADER ROW
LOCATION 'xxxx/csv/aggregate_test_100.csv';

SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1;
0VVIHzxWtNOFLtnhjHEKjXaJOSLJfm

SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1);
6WfVFBVGJSQb7FhA7E0lBwdvjfZnSW

explain SELECT array_agg(c13) FROM (SELECT * FROM aggregate_test_100 ORDER BY c13 LIMIT 1);
image

Expected behavior
A clear and concise description of what you expected to happen.
There is a sort operator in logical_plan, but there is no sort exec in c.

Additional context
Add any other context about the problem here.
Found in #5074

@xiaoyong-z
Copy link
Contributor Author

xiaoyong-z commented Jan 28, 2023

it seems that enforingsort removes the sortexec before the global limit:
image

@ozankabak
Copy link
Contributor

Yes, this seems to be a bug. Thanks for reporting, @mustafasrepo will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants