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

bug: order by and limit with empty scan can't find the column #17158

Open
1 of 2 tasks
b41sh opened this issue Jan 2, 2025 · 0 comments
Open
1 of 2 tasks

bug: order by and limit with empty scan can't find the column #17158

b41sh opened this issue Jan 2, 2025 · 0 comments
Labels
C-bug Category: something isn't working found-by-sqlsmith good first issue Category: good first issue

Comments

@b41sh
Copy link
Member

b41sh commented Jan 2, 2025

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.2.682

What's Wrong?

order by and limit with empty scan can't find the column

How to Reproduce?

root@0.0.0.0:48000/default> create table tt2 (c0 bool, c1 int);
processed in (0.297 sec)

root@0.0.0.0:48000/default> insert into tt2 values(true, 1),(false, 2),(true, 3);
3 rows affected in (0.223 sec)

root@0.0.0.0:48000/default> select null, c0, 30, c1 from tt2 where false order by c0 LIMIT 3 OFFSET 0;
error: APIError: QueryFailed: [1006]Unable to get field named "1". Valid fields: ["0", "2", "3"].

root@0.0.0.0:48000/default> explain select null, c0, 30, c1 from tt2 where false order by c0 LIMIT 3 OFFSET 0;

EXPLAIN SELECT NULL, c0, 30, c1 FROM tt2 WHERE FALSE ORDER BY c0 LIMIT 3 OFFSET 0

-[ EXPLAIN ]-----------------------------------
Limit
├── output columns: [tt2.c0 (#0), NULL (#2), 30 (#3)]
├── limit: 3
├── offset: 0
├── estimated rows: 0.00
└── Sort
    ├── output columns: [tt2.c0 (#0), NULL (#2), 30 (#3)]
    ├── sort keys: [c0 ASC NULLS LAST]
    ├── estimated rows: 0.00
    └── EmptyResultScan

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@b41sh b41sh added C-bug Category: something isn't working found-by-sqlsmith good first issue Category: good first issue labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working found-by-sqlsmith good first issue Category: good first issue
Projects
None yet
Development

No branches or pull requests

1 participant